Question
write the program in C++ with the proper indentation: 1. Declares a whole number type constant value space called MAX_ITEMS and Stores the value of
write the program in C++ with the proper indentation:
1. Declares a whole number type constant value space called MAX_ITEMS and Stores the value of 10
2. Declares an array that can store MAX_ITEMS number of names as string values
3. Declares an array that can store MAX_ITEMS number of ages as numeric values
4. Declares decimal variable spaces for storing total and average age values
5. Using a for repetition structure that runs MAX_ITEMS number of times,
a) prompts the user to input a persons name by using the prompt Enter a name: on the screen, for example: after the user entered the input, for example, bob: (enter a name: bob)
b) Reads the users inputted name from the keyboard and stores it in the array variable created for user-inputted names
c) prompts the user to input that persons age by name using the prompt Enters age: on the screen, for example: enter bob's age
d) Reads the users inputted value from the keyboard and stores it in the variable created for user-inputted ages
6. Using another repetition structure that runs MAX_ITEMS number of times, Retrieves the persons age from the ages array and Adds it to the total
7. After finding the total age of all the persons, Calculates the average age and Stores it in the variable average
8. Using another repetition structure that runs MAX_ITEMS number of times, Retrieves the persons name from the names array, and age from the ages array and Displays it as the output on the screen
9.Needs to output the total and average age values and Displays them as outputs on the screen with proper labels
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started