1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ankoles [38]
3 years ago
6

In the Happy Valley School System, children are classified by age as follows:less than 2, ineligible2, toddler3-5, early childho

od6-7, young reader8-10, elementary11 and 12, middle13, impossible14-16, high school17-18, scholargreater than 18, ineligibleGiven an int variable age, write a switch statement that prints out, on a line by itself, the appropriate label from the above list based on age.
Computers and Technology
1 answer:
Greeley [361]3 years ago
7 0

Answer:

int age = 10;

switch (age){

case 0:

case 1:

System.out.println("ineligible");

break;

case 2:

System.out.println("toddler");

break;

case 3:

case 4:

case 5:

System.out.println("early childhood");

break;

case 6:

case 7:

System.out.println("young reader");

break;

case 8:

case 9:

case 10:

System.out.println("elementary");

break;

case 11:

case 12:

System.out.println("middle");

break;

case 13:

System.out.println("impossible");

break;

case 14:

case 15:

case 16:

System.out.println("high school");

break;

case 17:

case 18:

System.out.println("scholar");

break;

default:

System.out.println("ineligible");

}

Explanation:

In java and many other programming languages, a switch statement is a way of having multiple branching options in a program. This is usually considered a more efficient way than using multiple if....else if statements. and the expression variables could be byte, char int primitive data types. etc. every branch (option) in a switch statement is followed by the break statement to prevent the code from "falling through". In the question The variable age is declared as an int and initialized to 10. and tested against the conditions given in the question.

You might be interested in
Suppose that a machine with a 5-stage pipeline uses branch prediction. 15% of the instructions for a given test program are bran
zhenek [66]

Answer:

solution attached below

Explanation:

3 0
3 years ago
What is an IF statement used for?
kiruha [24]

The IF statement is a decision-making statement that guides a program to make decisions based on specified criteria. The IF statement executes one set of code if a specified condition is met (TRUE) or another set of code evaluates to FALSE.

8 0
2 years ago
Scripting languages are unique computer languages with a specialized function. explain what scripting languages do, and how this
yarga [219]

Scripting languages are unique computer languages because they automate task that could be done by human operator and are easy to use.

<h3>What is a scripting language?</h3>

Scripting languages are programming languages that is interpreted.

They are programming languages that automates the task that will originally be performed by a human operator.

Scripting languages are used to give instruction to other software to run accordingly to how you want it.

The scripting language is different form other language base on the fact that its interpreted . This means the code are translated to machine code when it is run.

The major advantage of scripting languages is that it is human readable and understandable.

Examples of scripting languages are Python and JavaScript.

learn more on scripting here: brainly.com/question/12763341

#SPJ1

3 0
1 year ago
How do you get access To The advance server in Mobile legends
kiruha [24]

Answer: To enter the Advanced Server, please follow the below instructions: Tap into the Profile section and click Account Settings. Tap on the Switch Server button on the bottom right of the screen. This will allow the player to switch between the Original Server and Advanced Server.

Explanation: I play Mobile legends a lot so I know this

4 0
2 years ago
What kind of operating system is Windows? Command-line Browser based Graphical user interface Linux-based
snow_tiger [21]
Graphical user interface
4 0
2 years ago
Read 2 more answers
Other questions:
  • What is the most effect way to include space after each paragraph
    14·1 answer
  • Is a network traffic management device used to connect different network segments together?
    9·1 answer
  • (Game Design) Which of the following is NOT a name of a popular digital sculpting application?
    13·1 answer
  • If involved in a boating accident causing serious bodily injury or death while boating under the influence, the operator has com
    15·1 answer
  • When protecting a worksheet all cells are locked by default.?
    10·1 answer
  • You are contacted by a project organizer for a university computer science fair. The project organizer asks you to hold a forum
    10·1 answer
  • Which of the following is false about ERP II systems? Question 18 options: 1) They utilize the Web. 2) They include human resour
    9·1 answer
  • Adding Web pages helps Web designers ___. Choose all answers that are correct.
    13·1 answer
  • What are the different types of document required for mail merge?
    5·1 answer
  • Define the term hardwar<br><br>​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!