Need help with these free form Java questions. Professor did not give key for th
ID: 3558274 • Letter: N
Question
Need help with these free form Java questions. Professor did not give key for the practice test. Anyone able to help complete them?
Free Form Questions
16) Given the following tax table information, write Java code to assign the double taxRate appropriately given the double pay. Select the selection statement (if, if-else, switch) that makes the most sense. You do not need to write the complete program.
If pay is more than 100,000, tax rate is 40%
If pay is more than 60,000 and less than or equal to 100,000, tax rate is 30%
If pay is more than 30,000 and less than or equal to 60,000, tax rate is 20%
If pay is more than 15,000 and less than or equal to 30,000, tax rate is 10%
If pay is more than 5,000 and less than or equal to 15,000, tax rate is 5%
If pay is less than or equal to 5,000, tax rate is 0%
17) Complete the following program that adds the square of integers from lo up through hi (inclusive), and stores the result in result. Your program should compute lo^2 + (lo+1)^2 + (lo+2)^2 +
Explanation / Answer
16) Given the following tax table information, write Java code to assign the double taxRate appropriately given the double pay.
Select the selection statement (if, if-else, switch) that makes the most sense. You do not need to write the complete program.
double taxRate;
double pay;
//If pay is more than 100,000, tax rate is 40%
if(pay > 100000)
taxRate = 0.4;
//If pay is more than 60,000 and less than or equal to 100,000, tax rate is 30%
else if(pay >60000 && pay<=100000)
taxRate = 0.3;
//If pay is more than 30,000 and less than or equal to 60,000, tax rate is 20%
else if(pay >30000 && pay<=60000)
taxRate = 0.2;
//If pay is more than 15,000 and less than or equal to 30,000, tax rate is 10%
else if(pay >15000 && pay<=30000)
taxRate = 0.1;
//If pay is more than 5,000 and less than or equal to 15,000, tax rate is 5%
else if(pay >5000 && pay<=15000)
taxRate = 0.05;
//If pay is less than or equal to 5,000, tax rate is 0%
else if(pay <=5000)
taxRate = 0.0;
17) Complete the following program that adds the square of integers from lo up through hi (inclusive),
and stores the result in result. Your program should compute lo^2 + (lo+1)^2 + (lo+2)^2 +
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.