MCS273 Introduction to C++ Programming (January 2013)

Improved Pie and Bar Charts


Overview

The goal of this lab is to write a program that displays a pie chart and a bar chart representing an arbitrary number of categories. Your program should prompt the user to enter numbers and their corresponding category names to draw the corresponding pie and bar charts. To stop entering, the user is asked to enter "quit". For example, the user should input:

606:Freshmen
630:Sophomores
620:Juniors
599:Seniors
quit
to draw a pie and bar charts representing the number of students in each class at Gustavus. (Numbers are made up in the example above.)

Your programming task

You will write this program using appropriately designed functions and procedures that will make the programming much easier and more easily understood than the code you have written up to this point.

You should be able to work from your previous chart program that you wrote to handle four categories. When implementing the arbitrary number of categories and their values, use the C++ class Vector, which we covered in class.

Check-offs (3 points): When I check you off, I'll verify that you have:

  1. Your program functions as required and has a good makefile.

  2. The program is well-designed: i.e., it has appropriate and well-named procedures and an easy to follow logic. The procedures should not be too long and should have a clear purpose.

  3. Good testing, either in ccc_win_main (commented out) or in the debugger.

  4. The program and procedures are documented as described in C++ Style Guide.

Improving the improved pie and bar charts (optional)

Your pie and bar charts do not have any labels. Add appropriate labels to

  • Values and their percentage of each pie piece
  • X and Y labels for the bar chart
  • Values above the bars in the bar chart