Question: Please answer to all the questions below: QUESTION 1 : Suppose that we have the following piece of the code in main ( ) float

Please answer to all the questions below:
QUESTION 1:
Suppose that we have the following piece of the code in main()
float decimalNum1, decimalNum2;
Scanner keyboard = new Scanner(System.in);
System.out.println(Enter a decimal number: );
decimalNum1= keyboard.nextFloat();
Continue providing an if STATEMENT that assigns 23.46 to decimalNum2 when decimalNum1 is greater than 46.92
QUESTION 2:
Suppose that we have the following piece of the code in main()
float decimalNum1, decimalNum2;
Scanner keyboard = new Scanner(System.in);
System.out.println(Enter a decimal number: );
decimalNum1= keyboard.nextFloat();
Continue providing an if..else STATEMENT that assigns 46.92 to decimalNum2 when decimalNum1 is greater than or equal to 92.84 otherwise assign 84.68 to decimalNum2
QUESTION 3:
Using the following chart, write an if..else..if STATEMENT to select the rate depending on the sale amount listed on the left column:
Sale Amount Commission Rate
Less than or equal $80001.99%
Greater $10000 and up to $120002.59%
Over $120003.29%
QUESTION 4:
Suppose we have the following lines of code in main()
int integerNum1, integerNum2;
Scanner keyboard = new Scanner(System.in);
System.out.println(Enter a number: );
integerNum1= keyboard.nextInt();
System.out.println(Enter another number: );
integerNum2= keyboard.nextInt();
Continue providing a NESTED IF STATEMENT that performs the following
When integerNum1 is greater 553 and integerNum2 is greater than 678
And when integerNum1 is greater than integerNum2
then display the message:
integerNum1 and integerNum2 are greater than 678 and integerNum1 is greater than integerNum2
QUESTION 5:
Suppose we have the following lines of code in main()
int option;
System.out.println(MENU OF TASKS
+1.Option 1
+2.Option 2
+3.Option 3
+0.Exit.
;
System.out.println(Enter a number from 1 to 3 to select an option or 0 to Exit);
option = keyboard.nextInt();
if (option ==1)
{
System.out.println(You select OPTION 1) ;
}
else if (option ==2|| option ==3)
{
System.out.println(You select OPTION 2 or OPTION 3);
}
else if (option ==0)
{
System.out.println(Your select EXIT.);
}
else
{
System.out.println(Invalid option);
}
Question: Convert the above if..else..if STATEMENT into a SWITCH STATEMENT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!