Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 and adds 1 to the variable seniors if age is 65 or older.

if (age < 18) {

minors = minors + 1;

} else if (age > 17 && age < 65) {

adults = adults + 1;

} else {

seniors = seniors + 1;

}

Answers

Answer 1

Answer:

See Explanation

Explanation:

The answer you attached to the question is correct and it does not need any additional input.

However, I'll explain each line for you

This line checks if age is less than 18

if (age < 18) {  

This line increases minors by 1

minors = minors + 1;

}

This line checks if age is between 18 and 64

else if (age > 17 && age < 65) {  

This line increases adult by 1

adults = adults + 1;

}

This line checks if age is greater than 18

else {

This line increases seniors by 1

seniors = seniors + 1;

}


Related Questions

BRAINLIEST!!!!!!
I nEeD your HeLp​

Answers

Answer:

[tex]option \:1 . \: is \: cd \\ option \:2. \: is \: hard \: disk \: drive \\ primary \: memory \: is \: \: a \: memory \: dirctly \\ \: accessed \: by \: the \: cmp \\ why \: secondary \: is \: not \: directly \: accessed[/tex]

[tex]\boxed{1.)}\;Your\;answer\;is\;indeed\;cd.\\\\\\\boxed{1's\;explanation...\;>See\;Below<}\\\\\\An\;SSS\;device\;is\;a\;Solid-state \;storage \;device.\;It\;collects\;storage.\;Therefore,\;your\\\;answer\;is\;B,\;cd.[/tex]

[tex]\boxed{-----------------------------------}[/tex]

[tex]\boxed{2.)}\;Your \;answer\; is\; HDD.\\\\\\\boxed{2's \;Explanation...}\\\\\\A\;HDD\;is\;a\;drive\;located\;inside\;of\;a\;computer.\;Therefore,\;your\;answer\;is\;B.\\\\\\\boxed{------------------------------------}\\\\\\\boxed{Hope\;it\;helps!}\\\\\\\huge\boxed{Thanks,razorple.}[/tex]

I need to finish this assignment today. please help me!

Define: State your Goal What personal value would you like to share with the world?

what does this mean? I don't understand what a personal value is.​

Answers

Answer:

persanal value is the goal

Explanation:

mine would be:

less polution, the value is the goal

What are the simularities between the solar eclipse & lunar eclipse?

Answers

Answer:

An eclipse occurs when one celestial object obscures another celestial object. In the case of a solar eclipse, the moon moves between the Earth and the sun, thus obscuring the sun. A lunar eclipse occurs when the Earth moves directly between the sun and the moon. Either type of eclipse can be total or partial

What are some ways to enter and edit data in a worksheet? Check all that apply.
right-clicking the cell
zooming in on the cell
selecting the cell
selecting the cell and clicking the formula bar
clicking to select the cell and typing

Answers

Answer:

selecting the cell

selecting the cell, clicking the formula bar

double-clicking the cell

Explanation:

Because I watched a video

Answer:

C). selecting the cell

D). selecting the cell and clicking the formula bar

E). clicking to select the cell and typing

Explanation:

I just did the Instruction on EDGE2022 and it's 200% correct!

Also, heart and rate if you found this answer helpful!! :) (P.S It makes me feel good to know I helped someone today!!)

Workbook and worksheet are synonymous, where each workbook will contain only one worksheet

True or false

Answers

False a Brainiest would be appreciated if I’m right
This is a false statement

Which of the following statements are true regarding models? Select 3 options.
Models help you understand a complex situation by including all of the details.
In a model, the general characteristics are separated from the details.
Models help communicate a design.
Models help predict how a specific solution will respond.
Models represent the system or problem at a detailed implementation level.

Answers

Answer:

Models help predict how a specific solution will respond

In a model, the general characteristics are separated from the details

Models help communicate a design

Explanation:

I got 100% and I want to help you

Other Questions
Kelly buys four cardigans of the same price from a apparel store how much will she be billed if each Cardigin cost $79 Calculate the slope between the points: (4, -3) and (4,7)am=-1.25bm=undefinedCm=0.5m=0 Beth wants to paint the four walls of her rectangular bedroom. Her room is 10 feet wide, 13 feet long, and 8 feet high. She will not paint her rectangular door, which is 3 feet wide and 7 feet high. What is the total area of the walls that Beth needs to paint? A. 347 square feet B. 368 square feet C.578 square feet D. 1019 square feet E. 1040 square feet Disagreement over or competition for a resource is known by which of the following terms?logisticsconflictpreservationconservation A baseball's resultant velocity is 25.79 m/s, at 68.64 from the level ground.Determine the vertical component of the baseball's velocity. HELP ILL AWARD BRAINLIEST What is the underlying, fundamental force for the formation of all chemical bonds?A detailed explanation would be best, please. 55 in feet and inches tectonic plates move to Can someone explain which of Newtons Law is demonstrated in part 1 and which is demonstrated in part 2? (Picture) Passive transport moves materials from high to low which is ______ the concentration gradient.AgainstOverWithAround 3 Ag Brt Ga PO 4 AgPO4 + GabrzBalance or unbalanced PLEASE HELP!!! I DONT KNOW THISSS, DUE RLLY SOONJenny has only 3 1/2 cups of flour in her house. She needs 1 5/8 cups for a brownie recipe. Her sister Jody needs 1 3/4 cup flour for her cookie recipe. Will there be enough flour for both recipes? A group of students are given three problems to solve(Problem A, B and C.)13 students solve problem A, 17 solve problem Band 7 solve problem C.9 solve problems A and B.6 solve problems B and C.5 solve problems A and C.4 solve all three problems.2 solve none of the three problems.How many students are there altogether. Without external forces, the third generation of a bacterium and the original parent cell will have approximately ________ matching DNA sequences.(1 point)33%12.5% 100%25% Convert 50.0 mL to liters. Use the appropriate significant figures during the presidency of john adams, both france and britain supported American Indians impressed US sailors demanded bribes to create peace seized US ships Two neighbors in an apartment building have a shared balcony neighbor wants to use the space to barbecue and the other wants to utilize it to grow plants which component of conflict is most present in the situation ASAP!! If quadrilateral PQRS is a square, what are the coordinates of point E? The National Woman Suffrage Association first called for a constitutional amendment to give women the right to votein thea 1800sb. 1900sd. none of the aboveC.1700s