1. Declare 4 integer identifiers: w, x, y, and z. Initialize them (compile time) to 5, 10, 15 and 20
Then display the values as:
5 10 15 20
2. Write a program that displays your first name, last name (on one line), major, and college
public class SumAndAverage cfw_ / saved as "SumAndAverage.java"
public static void main (String args) cfw_
int sum = 0;
/ store the accumulated sum, init to 0
/ average in double
int lowerbound = 1; / the lower bound to sum
public class CheckPassFail cfw_ / saved as "CheckPassFail.java"
public static void main(String args) cfw_
int mark = 49;
/ set the value of mark here!
System.out.println("The mark is " + mark);
if ( . ) cfw_
System.out.println( . );
1. Write a class whose instances represent a single playing card from a deck of cards. Playing cards
have two distinguishing properties: rank and suit. Be sure to keep your solution as you will be asked
to rewrite it in.
2. Write a program called Product1
1. Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly. An appointment
has a description (for example, see the dentist) and a date. Write a method occursOn (int year, in
month, in day) that checks whether the appointment occurs o
1.After closing time, the store manager would like to know how much business was transacted during
the day. Modify the CashRegister class (CashRegister_02) to enable this functionality. Supply methods
getSalesTotal and getSalesCount to get the total amoun
1.What output is produced by the following code fragment?
Explain. System.out.print ("Here we go!");
System.out.print ("Test this if you are not sure.");
1. Write a program with loops that compute:
a. The sum of all even numbers between 2 and 100 (inclusive).
b. The sum of all squares between 1 and 100 (inclusive).
c. All powers of 2 from 20 up to 220 .
d. The sum of all odd numbers between a and b (inclus
1.Write a program that reads a number between 1,000 and 999,999 from the user and prints it with a
comma separating the thousands. .
Here is a sample dialog:
Enter an integer between 1,000 and 999,999: 23456
The answer is: 23,456
2.Implement a program tha
Write a program in which you declare and initialize m and n (run-time) and perform the following
a. n n /10 %10
b. n m %2 %2
c. ( ) / 2 m n
d. ( ) / 2. m n
e. (int)(0.5*( )
Suppose our cell phone carrier charges you $29.95 for up to 300 minute