3, Using the following chart, write an if-esle-if statement that assigns.10,.15,
ID: 3540392 • Letter: 3
Question
3, Using the following chart, write an if-esle-if statement that assigns.10,.15,or.20 to commission, depending on the value in sales.
Sales Commission Rate
---------------------------------------
Up to $10,000 10%
$10,000 to $15,000 15%
Over $15,000 20%
10, Convert the following if-else-f statement into a switch statement:
if (choice == 10)
{
System.out.println("You selected ten.");
}
else if (choice == 20 || choice == 30)
{
System.out.println("You selected twenty or thirty.");
}
else if (choice == 40 || choice == 50)
{
System.out.println("You selected forty or thirty.");
}
else
{
System.out.println("Select other Please.");
}
Explanation / Answer
3, Using the following chart, write an if-esle-if statement that assigns.10,.15,or.20 to commission, depending on the value in sales.
Sales Commission Rate
---------------------------------------
Up to $10,000 10%
$10,000 to $15,000 15%
Over $15,000 20%
if(amount <=10000)
commission = 0.10;
else if(amount>=10000 && amount <= 15000)
commission = 0.15;
else if(amount > 15000)
commission = 0.20;
10, Convert the following if-else-f statement into a switch statement:
switch(choice)
{
case 10: System.out.println("You selected ten."); break;
case 20:
case 30:System.out.println("You selected twenty or thirty."); break;
case 40:
case 50:System.out.println("You selected forty or thirty."); break;
default: System.out.println("Select other Please.");
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.