Module 6 - Lab - Ages
Objective
In this lab assignment, you will create a C++ program that prompts the user to input five ages, populates an integer array with the ages, and then calculates and displays the average age, the minimum age, and the maximum age using three functions.
Requirements:
Create a C++ program that contains the following functions:
a.double AverageAge(int[])
: This function takes the array of ages as input and returns the average age as a double.
b.int LowestAge(int[])
: This function takes the array of ages as input and returns the lowest age as an integer.
c.int HighestAge(int[])
: This function takes the array of ages as input and returns the highest age as an integer.Prompt the user to input five ages and store them in an integer array (See below for example input).
Use the above-defined functions to calculate the average, lowest, and highest age.
Display the ages in the array on one line separated by a comma.
Display the calculated average age, highest age, and lowest age.
Sample Input/Output:
Welcome to the Age Statistics Calculator!
Please enter 5 ages separated by spaces: 25 17 32 40 21
Ages entered: 25, 17, 32, 40, 21
Average Age: 27
Highest Age: 40
Lowest Age: 17
Note: The above sample input/output is just an example; the actual program may have more functionalities and validation checks.
Deliverable
Upload the following:
Full source code (.cpp file or .txt file)
Screenshot of the Console with the code executing
COSC-1336 / ITSE-1302 Computer Science - Author: Dr. Kevin Roark