CS 230 Spring 2007

Assignment 2 –Simple GUI and Calculations

100 points

 

Assigned: 01/31/2007

Due: 02/07/2007 at the start of class

 

Pre-Lab (Do Before Lab):  Bring materials – a way to save a copy for you and a copy to turn in. 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 round pizza for 10.99 or the 16 inch round pizza for 14.99, or the 12 X 16 inch Sicilian (rectangle) pizza for 16.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 either the diameter of the pizza (in inches) (in the case of a round pie) or the length and width (in the case of a Sicilian pizza). The task also involves performing calculations and displaying the output. In addition to the cost per square inch, also display intermediate results: the radius (for round) and the area (for either - in square inches).  Provide capabilities to calculate round, calculate rectangle, clear the text boxes to start again, and to exit.

 

Hand in:

 

Task Details:

·         We are making the simplifying assumption that pizza depth doesn’t vary. Don’t complain about Sicilian and Chicago Style, etc.

·         If you don’t remember how to calculate the area for a circle

·         Define pi as a constant equal to 3.14.

·         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) - it doesn’t have to just run, it needs to run correctly!

 

Miscellaneous:

·         You must turn on Option Strict and Option Explicit

·         Put YOUR NAME, e-mail address, date, and purpose of the program in comments at the beginning of the program. The purpose should be what the program is supposed to do, not the learning goals. Comments are indicated with a single quote (everything after the single quote is only for humans)

·         You MUST include comments that explain your program in order to get full credit.

·         Name all textboxes and buttons meaningfully, and use conventions for starting their names.

·         Make textboxes that user should never enter a value in “Read Only”

·         Remember to use meaningful variable names, and indent to show the structure of the program (VB usually does this correctly).

·         Put your name on the form as a Label or as part of the form title.

·         Try to use good user interface design. Make clear what user needs to do and what the answers mean.