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
How does technology affect our daily lives essay
Gnom [1K]

Technology affects almost every aspect of 21st century life, from transport efficiency and safety, to access to food and healthcare, socialization and productivity. The power of the internet has enabled global communities to form and ideas and resources to be shared more easily. However, the overuse of some technology has been linked to a decline in mental health, increased social division and privacy concerns.

We take technology for granted every day – even when it’s delivering us the latest news in an instant, making our cappuccino, or connecting us with a loved one halfway across the country (or even the world).

4 0
3 years ago
Read 2 more answers
The n modifier after the tilde forces the index variable to expand only to the ______
KATRIN_1 [288]

Answer: filename and extension.

Explanation:

Suppose we have %~nxa, where we have two modifiers n and x, and a single variable a.

So, the n modifier after the tilde forces the index variable to expand only to the  filename(by the n modifier) and the extension(by the x modifier).

It produces the filename and extension instead of the full path.

5 0
3 years ago
Missy creates a personal budget. She enters her current savings account balance in cell D3. In cell A3, she calculates her incom
sammy [17]
D3+(A3-B3) If you think of the future income and expenses then you can infer the expenses will lower the income amount so we use parenthesis and since there is money already in the account you would simply add that to the future total. <span />
7 0
3 years ago
Read 2 more answers
Why is dark supereffective against ghost?
Mice21 [21]

Answer:

hmmmmm...hold up let me look up what dark supereffective means XD...

Explanation:

?oh so i only see stuff about pokemon so id imagine its about that...

4 0
3 years ago
Read 2 more answers
When employees are hired, they agree to only use cell phones during breaks. How would you classify this?
Rasek [7]
Ddddddddddddddddddddddddddddddddddddddddd
7 0
3 years ago
Read 2 more answers
Other questions:
  • True or false: although the first personal computers were available as early as the 1970's, the creation of the world wide web (
    11·1 answer
  • You '' friend or ''like'' a page o your favorite social media page that advertises a
    10·1 answer
  • Read the PIC Data sheet Chapter 2.0 and 3.0 2. List at least 3 big differences between the Flash and RAM 3. How many RAM locatio
    5·1 answer
  • Are the actions legal or illegal?
    13·1 answer
  • Write a program that asks the user for three strings. Then, print out whether the first string concatenated to the second string
    8·1 answer
  • Name the functional arms of MSDE.
    13·1 answer
  • 1. What makes discrimination different from harassment? (Don't give me definitions.)
    5·1 answer
  • Convert this hexadecimal number to binary :. A07F​
    14·1 answer
  • Explain any two features of a computer​
    15·1 answer
  • Suppose the cache access time is 10ns, main memory access time is 200ns, and the cache hit rate is 90%. Assuming parallel (overl
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!