Question

Write an if/else statement that adds 1 to minors if age is less than 18, adds...

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

Homework Answers

Answer #1

Note: This code is wrtieen using "C".

if(age<18)
        minors = minors+1;
    else if (age>=18 && age<=64)
        adults= adults+1;
    else
        seniors= seniors+1;

The IF condition checks for the age < 18 and if its true then it increments minors or else go to next branching

Now IF is false then it comes to else if and checks that age should be in the range between 18 and 64; The logical operator "&&" checks and returns TRUE if both conditions are met or else it executes the ELSE statement.

If above both are false, then ELSE will be executed for age greater than or equal 65 people.

Any queires comment.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Video games are played by both minors under the age of 18 and adults over the...
Video games are played by both minors under the age of 18 and adults over the age of 18. Let us focus on the adult video game players. Records indicate that 42% of them are within the age of 18 – 25, 23% are within the age of 26 – 35, 17% are within the age of 36 – 45 and the remaining are 46 and older. Records also indicate that 72% of the video game players aged within 18...
1. For traditional college-age people (18-25), consuming moderate or high amounts of alcohol have what, if...
1. For traditional college-age people (18-25), consuming moderate or high amounts of alcohol have what, if any effect, on the parts of the brain that involve decision making? No effect Short-term problems (lasting 3-12 hours) Mid-term problems (lasting 2-3 days) Long-term problems (lasting 3-8 weeks) Permanent damage Not sure 2. Compared to older adults, traditional college-age drinkers are ____ likely to experience an alcohol blackout. More Unsure Less 3. Alcohol dependency is more likely in ____. A. Traditional college-age adults...
Write a program that checks the age of a user (C++ Programming)    If the user...
Write a program that checks the age of a user (C++ Programming)    If the user is 18 to 20 print “Sing a song” If the user is younger than 18 then print “Please show a dance step” Else Welcome the user and print “You are audience”
A certain financial services company uses surveys of adults age 18 and older to determine if...
A certain financial services company uses surveys of adults age 18 and older to determine if personal financial fitness is changing over time. A recent sample of 1,000 adults showed 410 indicating that their financial security was more than fair. Suppose that just a year before, a sample of 800 adults showed 280 indicating that their financial security was more than fair. What is the 95% confidence interval estimate of the difference between the two population proportions? (Round your answers...
Question 18: Height and age: Are older men shorter than younger men? According to a national...
Question 18: Height and age: Are older men shorter than younger men? According to a national report, the mean height for U.S. men is 69.4 inches. In a sample of 170 men between the ages of 60 and 69 , the mean height was =x69.3 inches. Public health officials want to determine whether the mean height μ for older men is less than the mean height of all adult men. Assume the population standard deviation to be =σ2.71 . Use...
A person is said to be overweight if his or her Body Mass Index is between...
A person is said to be overweight if his or her Body Mass Index is between 25 and 29, inclusive, and a person is said to be obese if his or her Body Mass Index is 30 or greater. In 2018, the Utah Department of Health issued the following table. The first two columns of the table provide the age distribution for adults living in Utah. The third column gives the percentage of adults in each age group who are...
Country Financial, a financial services company, uses surveys of adults age 18 and older to determine...
Country Financial, a financial services company, uses surveys of adults age 18 and older to determine if personal financial fitness is changing over time (USA Today, April 4, 2012). In February of 2012, a sample of 1000 adults showed 410 indicating that their financial security was more than fair. In February of 2010, a sample of  900 adults showed 315 indicating that their financial security was more than fair. What is a 99% confidence interval estimate of the difference between the...
An article about the California lottery gave the following information on the age distribution of adults...
An article about the California lottery gave the following information on the age distribution of adults in California: 35% are between 18 and 34 years old, 51% are between 35 and 64 years old, and 14% are 65 years old or older. The article also gave information on the age distribution of those who purchase lottery tickets. The following table is consistent with the values given in the article. Suppose that the data resulted from a random sample of 200...
Country Financial, a financial services company, uses surveys of adults age 18 and older to determine...
Country Financial, a financial services company, uses surveys of adults age 18 and older to determine if personal financial fitness is changing over time (USA Today, April 4, 2012). In February of 2012, a sample of 1000 adults showed 410 indicating that their financial security was more than fair. In February of 2010, a sample of  900 adults showed 315 indicating that their financial security was more than fair. What is a 99% confidence interval estimate of the difference between the...
a survey of 2290 adults in a certain large country aged 18 and older conducted by...
a survey of 2290 adults in a certain large country aged 18 and older conducted by a reputable polling organization found that 404 have donated blood in the past 2 years. complete parts a through c. a.) obtain a point estimate for the population proportion of adults in the country aged 18 and older who have donated blood in the past 2 years. b.) verify that the requirements for constructing a confidence interveal about p are satisfied. the sample____ a...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • List and briefly explain each step in the ABCDE technique for examining irrational beliefs that contribute...
    asked 5 minutes ago
  • 1. Find the general solution of the first order linear differential equation: 2*x*dy/dx -y-3/sqrt(x)=0. sqrt() =...
    asked 27 minutes ago
  • Fairfield Homes is developing two parcels near Pigeon Fork, Tennessee. In order to test different advertising...
    asked 32 minutes ago
  • . For each of the following questions, say whether the random process is reasonably a binomial...
    asked 45 minutes ago
  • Please discuss why empathy is so important in light of current events. Please give specific examples
    asked 1 hour ago
  • Describe ONE thing you learned from either Peter singer or Tibor Machan author that compelled you...
    asked 1 hour ago
  • Global logistics firms such as DHL Supply Chain and Global Forwarding or C. H. Robinson Worldwide...
    asked 1 hour ago
  • Please match each factor in adoption of a new product or service to the best match...
    asked 1 hour ago
  • Fatty Acid Synthesis Assignment Explain how the activation of acetyl-CoA carboxylase prevents excess citrate in the...
    asked 1 hour ago
  • 1. Discuss and give an example of how a person might “constructively” enter a building of...
    asked 1 hour ago
  • Define the channel type for a natural trapezoidal dirt channel with a roughness of 0.045. The...
    asked 1 hour ago
  • Petroleum Production Engineering How can flow efficiency being improved without resulting into increasing water production?
    asked 2 hours ago