2Variable namesWhich of the following may be used as variable names in Java?rate11stPlayermyprogramswitchlongTimeLimitnumberOfWindows
3Variable namesCan a Java program have two different variables named number and Number?
4VariablesGive the declaration for two variables called count and distance. count is of type int and is initialized to zero. distance is of type double and is initialized to 1.5.
5Expressions What is the output of the following program lines: double number = (1/3) * 3;System.out.println( "(1/3) * 3 is equal to " + number );
6Expressions What is the output produced by the following code: int result = 11;result = result / 2;System.out.println( "result is " + result );
7Output What is the output produced by the following: String verbPhrase = "is money";System.out.println( "Time" + verbPhrase );
8Output What is the output of the following: System.out.println( "2 + 2 = " + (2 + 2) );System.out.println( "2 + 2 = " );
9CommentsWhat are the two kinds of comments in Java?
10Comments What is the output produced by the following Java code? System.out.println( "Hello" );//System.out.print( "Mr. or Ms. " );System.out.println( "Student" );
11CouponsThe skeeball machines on the boardwalk in Wildwood output coupons according to how well you play the game.You can redeem 10 coupons for a candy bar or 3 coupons for a gumball. You prefer candy bars to gumballs.Write a program that defines a variable initially assigned to the number of coupons you win. Next, the program should output how many candy bars and gumballs you can get if you spend all of your coupons on candy bars first, and any remaining coupons on gumballs.
12Strings What output is produced by the following: String s = "Hello" + "Joe";System.out.println( s );
13StringsWrite Java statements that will cause the following to be written to the screen:One two buckle your shoe.Three four shut the door.
14StringsWhat is the difference between System.out.println and System.out.print?
15Strings What is the output produced by the following: System.out.println( 2 + " " + 2 );System.out.println( );
16Sum, difference, and product Write a program that reads in two integers (typed from the keyboard) and outputs their sum, difference, and product.
17The cost of gasA car is used for commuting. Write a program that takes as input the distance of the commute in miles, the car’s fuel consumption rate in miles per gallon, and the price of a gallon of gas. The program should then output the cost of the commute.
18Make changeWrite a program that determines the change to be dispensed from a vending machine. An item in the machine can cost between 25 cents and a dollar, in 5-cent increments, and the machine accepts only a single dollar bill to pay for the item.For example, a possible sample dialog might be:Enter price of an item: 45You bought an item for 45 cents and gave me a dollar so your change is:2 quarters0 dimes, and1 nickel