Pie Chart Example
Computer Science 125, Lecture 1
Boise State University, Spring 1999
Introduction to Computer Science
Here's a step-by-step breakdown of the group work problem
P3.15 (making a piechart).
- First Stage: Put in steps of algorithm as comments.
Compile to make sure there's no typos.
- Second Stage: Declare variables and do the easy steps of getting the
input and drawing outer circle.
Add an extra line to make sure the numbers are being
read in correctly (to be removed later).
Compile and make sure it works before going on.
- Third Stage: Calculate first angle. Run test cases to make sure
calculation is correct.
Remove the line added to test if numbers were being
read in.
Compile and make sure it works before going on.
- Fourth Stage: Calculate the rest of the angles, using the positive
x-axis as base.
Compile and make sure it works before going on.
- Fifth Stage: Add constants for "magic numbers", in this
case the radius of 5.
Compile and make sure it works before going on.