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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Two students are discussing electricity that has a frequency of 60 hz. student a says that this type of electricity is referred to as ac. student b says that in this type of electricity, the electrons flow in only one direction. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
question
Computers and Technology, 24.06.2019 20:00
Avirus enters a computer or network as code embedded in other software directly from another computer
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
question
Mathematics, 19.04.2020 22:06
question
English, 19.04.2020 22:06
question
Mathematics, 19.04.2020 22:07