CS 230 Fall 2004

Assignment 2 –Simple GUI and Calculations

100 points

 

Assigned: 09/14/2004

Due: 09/20/2004 at the start of class

 

Pre-Lab (Do Before Lab):  Bring a new disk. Plan out tasks, objects, and events needed for program.

 

Main Assignment:

Imagine that you are writing a program for a small computer you carry with you. Imagine that your favorite food is pizza, and you like to see what is the best pizza deal (e.g. the 14 inch pizza for 10.99 or the 16 inch pizza for 14.99) since you’re perfectly happy to take any leftovers home for breakfast tomorrow. Write a program that calculates the price per square inch for pizza from a restaurant. This will require obtaining the price of the pizza, and the diameter of the pizza (in inches). The task also involves performing calculations and displaying the output. In addition to the cost per square inch, also display intermediate results: the radius and the area (in square inches).  Provide capabilities to calculate, clear the text boxes to start again, and to exit.

 

Hand in:

 

Miscellaneous:

               Define pi as a constant equal to 3.14159.

 

Note that we have now covered specifying how many decimal places to display – display a number appropriate for the results.

 

Note that we haven’t done anything yet with making sure the user enters something reasonable – don’t worry about that.

 

MAKE SURE YOUR PROGRAM WORKS! (i.e. gets the correct answers).

 

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.

 

Try to use good user interface design.