subject

Suppose you want to write an if statement with multiple alternatives to print out someone's tax bracket based on their income. Assume the integer variable income holds the annual income. What is wrong with the following if statement?if (income < 10000)
{
System. out. println("Lowest tax bracket");
}
if (income < 20000)
{
System. out. println("Low-Middle tax bracket");
}
if (income < 30000)
{
System. out. println("Middle tax bracket");
}
System. out. println("High tax bracket");

a) The conditions are in the wrong order; the check for the highest bracket should be first
b) The conditions should use an if else/if else sequence, not just independent if statements
c) The conditions should be a switch statement instead
d) Nothing is wrong - the if statement will correctly print out the tax brackets

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:00, Paulalex8765
Select all that apply. what types of documents can be created using word-processing software? business newsletters letters of application presentation slideshows customer databases
Answers: 1
image
Computers and Technology, 23.06.2019 08:30, mai1261
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
image
Computers and Technology, 24.06.2019 02:10, sIatt
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
Answers: 2
image
Computers and Technology, 24.06.2019 09:00, lisacarter0804
Why might you chose to crest a function resume
Answers: 1
You know the right answer?
Suppose you want to write an if statement with multiple alternatives to print out someone's tax brac...

Questions in other subjects:

Konu
Mathematics, 29.08.2019 16:30