Your Loss Our Gain

Programming Assignment

The Get-Rich-Quick Weight Loss Center awards a prize annually to the client who has lost the most weight. The record of each client contains the following information:

    • name

    • "before" weight in pounds

    • "after" weight in pounds

You are to write a program that finds the client who has lost the most weight this past year, and who will therefore be awarded the prize. Also find the client who has lost the least weight. You may assume that nobody has actually gained weight, and that there are no ties. Read client data without assuming a fixed number of clients (use a sentinel value to end the input data). Use the following 3 datasets to test your program.

THE FOLLOWING INSTRUCTIONS MAY BE HELPFUL IF YOU ARE HAVING TROUBLE WITH THIS ASSIGNMENT.

Do your assignment in the following stages:

A. HW A - Write a program that will read client data; compute the weight loss for each client; and output the maximum weight lost.

B. HW B - Modify program A. In addition to displaying the maximum weight loss over all clients, also output the name of the client who lost the most weight and print a message of congratulations to the winner. Use the <string> class library.

C. HW C - Modify program B. Also display the name of the client who lost the least weight, and print an appropriate comforting message.