Write a program that computes the average age of adults in a sample population. The program...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that computes the average age of adults in a sample population. The program prompts the user to enter the size of the population and then using a for loop, it shall prompt the user for the age of every person in the population. The program shall compute the average age of adults only. Produce output as shown in the sample input/output. Note: an adult is a person whose age is 18. Sample input/ output: Enter size of population sample : 6 Enter age of person # 1: 20 Enter age of person # 2: 10 Enter age of person # 3: 15 Enter age of person # 4: 24 Enter age of person # 5: 19 Enter age of person # 6: 18 There are 4 adults in the population sample. The average age of adults is: 20.25 Write a program that computes the average age of adults in a sample population. The program prompts the user to enter the size of the population and then using a for loop, it shall prompt the user for the age of every person in the population. The program shall compute the average age of adults only. Produce output as shown in the sample input/output. Note: an adult is a person whose age is 18. Sample input/ output: Enter size of population sample : 6 Enter age of person # 1: 20 Enter age of person # 2: 10 Enter age of person # 3: 15 Enter age of person # 4: 24 Enter age of person # 5: 19 Enter age of person # 6: 18 There are 4 adults in the population sample. The average age of adults is: 20.25
Expert Answer:
Answer rating: 100% (QA)
This looks like a programming exercise where the goal is to write a program that calculates the aver... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Mention disciplinary measures that can be taken against any erring officer?
-
Modify BST to add a method size() that returns the number of key-value pairs in the symbol table. Use the approach of storing within each Node the number of nodes in the subtree rooted there.
-
A project has the following cash flows a. What is the project's payback period? b. Calculate the projects NPV at 12%. c. Calculate the project's PI at 12%. ) (S700) $200 $500 $244
-
A woman with 28 years of experience was an exemplary employee who had been nationally recognized for her planning work. She applied for the promotional position of Plan Formulation Specialist. The...
-
In the summer of 2012, a Toronto Star investigation reported that construction and maintenance workers who were supposed to be working at Toronto public schools were spending their mornings at Tim...
-
(a) Does the home buyer enjoy tax advantages? Explain. (b) Discuss Maggis belief that cash flow is better with renting. (c) Suggest some reasons why Michael might consider renting rather than...
-
Guideline (or Comparable) public companies ("GPC") valuation approach within the market approach grouping involves the comparison of valuation multiples and operating metrics of public companies in a...
-
Prevosti Farms and Sugarhouse pays its employees according to their job classification. The following employees make up Sugarhouse's staff: Employee Number Name and Address Payroll information...
-
Questlon 4 [51] Girotech's CEO instructed the project team investigating the acquisition of two additional 3D printers to also make recommendations as to whether the printers should be acquired using...
-
JMC Co. takes out a 3-year loan of $700,000 from a bank. It keeps $200,000 in its chequing account, and uses the rest to purchase a new sorting machine for its factory. How is shareholder's equity...
-
A member firm is required to verify the identification of ti customers and run a check in accordance with regulations established by OFAC . What is OFAC and the purpose of the I.D. check?
-
Name one reference group that has influenced your recent purchase. *During my vacation in Korea, I meet my best friend who influenced me to buy one of cosmetic's brand names 3CE ......etc Elaborate...
-
Sean and Evan are seling rol's of wrapping paper to raise maney for new foothal uniforms. Evan has sold seven more than one-half the number of rolls that sean has. Ir they have sold a total of 121...
-
An assignment instruction on how to evaluate a financial annual report for any chosen company is: 1. Choose a company that you are interested in and find its most recent annual report online. You can...
-
Paar Corporation bought 100 percent of Kimmel, Inc., on January 1, 2018. On that date, Paar's equipment (10-year remaining life) has a book value of $420,000 but a fair value of $520,000. Kimmel has...
-
The roof of a refrigerated truck compartment is of composite construction, consisting of a layer of foamed urethane insulation (t2 = 50 mm, ki = 0.026 W/m K sandwiched between aluminum alloy panels...
-
Programming Exercise 6.39 gives a method for testing whether three points are on the same line.Write the following method to test whether all the points in the array points are on the same...
-
Suppose a file is encrypted using the scheme in Programming Exercise 17.14. Write a program to decode an encrypted file. Your program should prompt the user to enter an input file name for the...
-
Revise GraphView in Listing 28.6 to display a weighted graph. Write a program that displays the graph in Figure 29.1 as shown in Figure 29.25. (Instructors may ask students to expand this program by...
-
Does the snowflake have rotational symmetry in Figure 1.6? If yes, describe the ways in which the flake can be rotated without changing its appearance. Does it have reflection symmetry? If yes,...
-
Which of the following statements are hypotheses? (a) Heavier objects fall to Earth faster than lighter ones. (b) The planet Mars is inhabited by invisible beings that are able to elude any type of...
-
A battery-operated wall clock no longer keeps timeneither hand moves. Develop a hypothesis explaining why it fails to work, and then make a prediction that permits you to test your hypothesis....
Study smarter with the SolutionInn App