CS 230 Fall 2009 Assignment
4 –More Complicated Branching 100
points
Assigned: 09/28/2009
Due: 10/06/2009 at the start of class – NOTE: I
have made it due on Tuesday so that it is not due the same time as when the
test probably will be. However, it must be done by class time on the due date.
There will be a new assignment for that day!
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. There is
some complicated logic – think about it BEFORE lab!!
Main Assignment:
The Penn State – Germantown Campus (made up) has asked you to develop a program to calculate
(simplified) tuition and fees. You will need to get as input from the user the
number of credits, and whether the student is “In State” or not, and whether
the student will live in the dorms or not (checkboxes for each). You will then
need to calculated tuition and board and total costs. Tuition is according to
the following scheme:
Per Credit Costs
|
In State
|
Out of State
|
First 12 Credits
|
600
|
1200
|
Next 9 Credits
|
200
|
500
|
In addition, the
state in an effort to encourage less pollution / demand on highways / more use
of already paid for dorms, has decided to offer a 20% discount on tuition
for any student who lives in the dorms. The dorm cost is $5000. For
calculations, show Basic Tuition Cost, Discount (0 if none), Final Tuition,
Dorm Cost (0 if not in dorm), and Total Cost as results. In addition to the calculate capability, provide
capabilities to clear all of the controls (text boxes and checkboxes) 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 4).
Background Knowledge:
- Costs are given above. If you have any questions about the tuition
scheme, please ask!!! Read carefully! Your calculations need to meet the
requirements of the task. Especially please note that the costs are “per
credit costs”, so 3 credits “in state” is $1800
Task Details:
- 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 no longer going to assume that the clerk enters valid and
reasonable values, so ensure that values entered are numbers and that they
are in acceptable range (validate input). Let’s assume that the number of
credits needs to be from 1-21.
- 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. Think, “what
different possibilities need to be checked?” For each, calculate the
correct answer by hand and see if your program gets it!. One
example to get you started: 15 credits for an “In State” student living in
the dorms should have a basic tuition of $7,800, a discount of $1,560, a
final tuition of $6,240, a room cost $5,000 and a total cost of $11,240.
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 yournameAssignment4
- Print out of your code.