CS 230 Fall 2009
Assignment 3 –Simple IFs and Calculations
100 points
Assigned: 09/21/2009
Due: 09/28/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. Plan main button(s) with pseudocode or flowchart.
Main Assignment:
Imagine
that you are writing a program for an amusement park. The amusement park
charges admission based on the following criteria. Start with a base charge of
$5. Add $2 for every year of age, up to a maximum of $20 additional ($25
total). Add $10 if the person is taller than 48 inches tall (so a maximum
overall of $35). Tax is 8%. Write a program that calculates the price of
admission for a customer. The task involves getting needed info from the user, performing
calculations and displaying the output. In addition to the total admission cost,
also display intermediate results including the subtotals and amount of tax.
Provide capabilities to calculate 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 3).
Background Knowledge:
Task Details:
- Define key numbers in
the program (e.g. $5 base charge, $10 charge for people tall enough to
ride the good rides) as named constants and use them.
- Note that we have now
covered specifying how many decimal places to display – so display all
money with dollar signs and two decimal places..
- We’re going to
continue (for now) assuming that the clerk enters valid and reasonable
values, so we’re not taking on too many new tasks at once.
- MAKE SURE YOUR PROGRAM
WORKS! (i.e. gets the correct answers) - it doesn’t have to just run, it
needs to run correctly! Now that our program is branching, we
need to try more examples to make sure that they work.
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 used
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 yournameAssignment3
- Print out of your code.