CS 230 Spring 2005                        Assignment 4 – More Complicated Branching                                    100 points

 

Assigned: 02/14/2005

Due: 02/21/2005 at the start of class

 

Pre-Lab (Do Before Lab):  Bring a new disk. Plan out tasks, objects, and events needed for program. Plan out major pseudocode. This program has 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

500

900

Next 9 Credits

100

300

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 $4000.  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.

 

Hand in:

  • Floppy disk with an entire folder containing all files related to the project. Please set the name of the project to something other than the default name (WindowsApplication1, …). 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:

  • If you have any questions about the tuition scheme, please ask!!! Read carefully! Your calculations need to meet the requirements of the task.
  • 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 per credit costs, the number of credits for the threshold (12) cost, the cost for living in the dorms … all should be declared as constants to make it easy to implement future changes.
  • Note that we have now covered specifying how many decimal places to display – display the charge as currency.
  • 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 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!). 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 $6,300, a discount of $1,260, a final tuition of  $5,040, a room cost $4,000 and a total cost of $9,040.
  • 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.