CS 157 Spring 2001
Assignment 2 –Calculations
100 points
Assigned: 01/24/2001
Pre-Lab (Do Before Lab): Bring a new disk. Plan out sequence of statements needed for program.
Main Assignment:
Write a
program that calculates the price per square inch for pizza from a restaurant.
This will require getting 2 pieces of data from the user: the price of the
pizza, and the diameter of the pizza (in inches). The task also involves
performing calculations and displaying the output. The necessary information is
given below.
NAME
YOUR PROGRAM FILE yourlastname2.c
Sample interaction with the user:
Welcome to the
Consumer Value Pizza Calculator
Enjoy!
Please enter
the price of the pizza: 10.50
Please enter the diameter of the pizza (in inches): 16
Results:
Diameter: 16
Radius: 8.00 Area:
201.06 Price: 10.50
The Cost Per
Square Inch Is: 0.052
Hand-in:
1) Listing (print out) of the program
file.
2) Disk with: program file
(yourlastname2.c) and executable file ( .exe file – probably found in Debug
folder inside project folder).
Due: 01/31/2001
Miscellaneous:
To avoid having to use the math library, define pi as
a constant equal to 3.1415
Please
try to make the output of your program like mine, to aid my grading.
MAKE
SURE YOUR PROGRAM WORKS! (i.e. more than just removing compile errors).
Put
YOUR NAME, and e-mail address in comments at the beginning of the program.
You
MUST include comments that explain your program in order to get full credit.
Note that you may need to follow instructions
under “Saving Space” when creating the project if you are using a floppy.