CS 230 Spring 2005
Assignment 3 –Simple IFs
100 points
Assigned: 02/07/2005
Due: 02/14/2005 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:
A parking garage
charges a $5.00 minimum fee to park for up to 3 hours. The garage charges an
additional $1.00 per hour or each part thereof in excess of 3 hours. The
maximum charge is $10.00. On top of this (in addition to this), large vehicles
(vans, SUVs) are charged an extra $2.00 (thus a van that parked long enough
could be charged as much as $12.00). Write a program that gets from the user
the number of minutes spent in the garage, and whether the vehicle is a large
vehicle (Checkbox recommended), and reports the parking fee. Your program
should include a “Check Out” button that will calculate and display the total charge. In addition to the calculate
capability, provide capabilities to clear all of the controls (text
boxes and checkbox) to start again, and to exit.
Hand in:
- Floppy disk with an entire folder containing all files
related to the project. Use Windows to copy the whole folder, instead of
trying to “Save As”.
- Print out of your code. Avoid printing the code generated
from the visual creation of the form.
To avoid needless long waits, I recommend doing this on the
c: or other drive, then upon completion, copying it to the a: drive, testing it
there, and creating an extra backup for yourself.
Miscellaneous:
- Hint: In figuring out how many hours to charge for when somebody has not
stayed an even number of hours,
- Some built-in VB methods that could be useful include
Convert.toInt32 and Math.Ceiling (which finds the largest number greater
than or equal to a given number (Math.Ceiling of 5.4 would be 6). (it
returns a double, so a convert to integer may also be needed).
- Define numbers (especially those that could change sometime in the
futures) as named constants. E.g. the minimum fee, the basic cost, the
number of hours you get for that basic cost, … all should be declared as
constants to make it easy to implement “revenue enhancements.”
- Note that we have now covered specifying how many decimal places to
display – display the charge as currency.
- We’re going to assume that the clerk enters valid and reasonable
values for now, so that we’re not taking on too many new tasks at once.
- Make outputs “Read Only” so the user cannot change the calculated
results.
- You must turn on Option Explicit and Option Strict.
- MAKE SURE YOUR PROGRAM WORKS! (i.e. gets the correct answers). It
should run on any inputs (We are now branching – so the program must be
tested on more inputs to ensure that all paths through the program code
work!). One example to get you started: 250 minutes for an SUV should cost
$9.00.
- Put YOUR NAME, and e-mail address, date and purpose in comments at
the beginning of the program.
- You MUST include comments that explain your program in order to get
full credit.
- 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.