Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ program name manageweight.cpp to read a list of names and their weights in pounds, store them in 2 lists and process them
Write a C++ program name manageweight.cpp to read a list of names and their weights in pounds, store them in 2 lists and process them based on the following requirements: - Write a function to prompt the user to enter a filename, read the list of integer numbers and names(1 name and weight per line) each corresponding to a person's weight in pounds and their name. Store all weights and names in 2 arrays. Assume there are no more than 10 elements (name and weight) in the file, but could be less. Make your array size 10. The function updates teh arrays and return the number of elements read from the file. File Format: Name Weight Sample file: \begin{tabular}{lr} Joe & \multicolumn{1}{c}{67} \\ Nancy & 123 \\ Allen & 234 \end{tabular} Requirements - Add a function to calculate and store the weights in kilograms in a float array, each kilogram is 2.2lbs. - Add a function to find the highest, lowest weight, and average of the weight and send them back to the caller. - Add a function to print the lists of names, weights. see sample below. - Add a function to sort lists (names and weights) based on weights from least heavy to heaviest weight. - Add the main function to call the functions and produce the following output. - Add main function to perform the following tasks: - Declare arrays and any variable you need - Call readData function - Call printData function - Call processData function (to find, high, low and average of weights - Print high, low and average (see format below) - Call sort function - Call printData function Sample output
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