Question
quetion 1 The following statement uses a combined assignment operator to add total to the result of the other math operations and store the sum
quetion 1
The following statement uses a combined assignment operator to add total to the result of the other math operations and store the sum back into total. On the right-hand side of this combined assignment operator, the remainder is obtained from dividing 10 by 3. That remainder is multiplied by 5.
total ___ (10 ___ 3) ___ 5;
question 2
The following program makes an object of the Scanner class called keyboard. The user's input is then assigned to the variable age (make sure the method is appropriate for the data type of age). Finally, this input is displayed to the console with the message in the last print statement.
int age = 0;
___ keyboard = ___ ___(System.in);
System.out.print("Please enter your age: ");
age = keyboard.___();
System.out.println("Your age is " + ___);
question 3
The following switch statement takes an int named choice. If choice is 1, the first print statement is executed. If choice is 2, the second print statement is executed. If choice is 3, the third print statement is executed. And if choice is any other value, the final print statement is executed.
switch(___)
{
___ : System.out.println("This is the right choice.");
break;
___ : System.out.println("But this might be ok too.");
break;
___ : System.out.println("Or I guess this works as well.");
break;
___ : System.out.println("Please enter either 1, 2, or 3.");
}
For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started