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
Consider the following two code segments: Segment 1: while (k > 0) { System.out.println(k); k--; } --------------- Segment 2:
zepelin [54]

Answer:

Always same value

Explanation:

These both code segments will always generate identical values given that we provide same value of k to both segments.

You can see attached pictures.

6 0
3 years ago
What statement is used to close a loop started with a for statement?
liraira [26]
If I get what you are saying then you could use a work like end. :)
5 0
3 years ago
[name] was planning a dream vacation to [place].
Gwar [14]
Alexis was planning a dream vacation to Spain.

Alexis/She was especially looking forward to trying the local cuisine, including the famous Paella and Churros.

Alexis will have to practice the language
frequently to make it easier to speak with people.

Alexis/She has a long list of sights to see, including the El Prado museum and the beautiful park.


Hope this helps :)
5 0
3 years ago
Why am I constantly getting bombarded with brainly plus ads and how to fix this without paying for it?
Helga [31]

Answer:

there really is no way to fix it. I've tried everything everybody says sorry

8 0
3 years ago
Read 2 more answers
The valence electron configurations of several atoms are shown. how many bonds can each atom make without hybridization? 2s^2 2p
Pie
Answer: This element needs 3 electrons to complete its octet state

Why?:
since the electrons in 2s2 are already paired they cannot form a bond pair with electrons from other elements without hybridisation however the 3 electrons in 2p3 are unpaired so can form bond pairs with electrons from other elements without hybridisation.

Hope this helps!
3 0
4 years ago
Other questions:
  • What is life all about?
    15·2 answers
  • What is the problem with assigning a port number to more than one server application?
    8·1 answer
  • The incident results in huge losses of revenue as a result their mobile app service is withdrawn. Investigators discovered a vul
    5·1 answer
  • Which sentence uses a pair of synonyms? Because there was so much shouting, many of the protestors began screaming in order to b
    6·2 answers
  • The _____ is an information and communication-based electronic exchange environment mostly occupied by sophisticated computer an
    14·1 answer
  • Which procedure is used as a physical barrier to secure data against unauthorized access in a cloud storage data center?
    6·1 answer
  • Define the following term. data, database, DBMS, database system, data- base catalog, program-data independence, user wen', DBA,
    12·1 answer
  • True / False<br> General purpose registers can be read and written by ML programs
    10·1 answer
  • Name the application used for creating Presentations___
    5·2 answers
  • In a three-tier architecture, the component that runs the program code and enforces the business processes is the:_______.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!