CS 230 Fall 2009
Assignment 2 –Simple GUI and Calculations
100 points
Assigned: 09/14/2009
Due: 09/21/2009 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 8 X 12 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.
Please
set the name of the project to something other than the default name (WindowsApplication1, …). It
is helpful if you use a name that identifies you as well as the assignment
(e.g. yourlastname assignment 2).
Background Knowledge:
- Hopefully you know the
math for calculating the area of a circle and a rectangle. If not, you can
probably find them via Google.
Task Details:
- We are making the
simplifying assumption that pizza depth doesn’t vary. Don’t complain about
Sicilian and Chicago Style, etc.
- Define pi as a
constant equal to 3.14.
- Note that we have not
covered specifying how many decimal places to display – so if the answers
have too many or too few decimal places, don’t worry about it.
- 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 ending their names. Also,
any labels referred to in code should also be named meaningfully.
- Make any textboxes
that user should never enter a value in “Read Only” (or use labels
instead!)
- Any variables that you
declare should have meaningful names – descriptive of the data that they
hold.
- 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.
- Any label controls use
for results will be easier to find and click on etc if you turn the
AutoSize property to false and size it yourself.
Hand in:
- Compressed (zipped) folder with your entire project containing
all files related to the project, submitted to Blackboard. Please
name the zip file something along the lines of yournameAssignment2
- Print out of your code.