CS 1401 Assignment #7

Date Assigned: Monday, March 3, or Tuesday, March 4, 2008.

Due Date: Monday, March 10, or Tuesday, March 11, 2008, before the beginning of your lab section.

Objective: The main objective of this assignment is to learn to design user-defined methods.

Programming assignment:   Write a program to help compute total tuition and fees a student must pay for one semester.  

Part 1.  You should include:

  1. a method that, given a name of a file with data for a single student (see format below), reads the file, and computes the total fees and tuition required for the student;
  2. a program that uses this method; and
  3. an itemized statement displaying information about the student, the individual tuition and fees owed, and the amount of the total bill.


Data to use:

·         For Part 1, use the amount of $143.70 per credit hour for tuition charges for each student. 

·         The following fees apply to each student.  The name of the fee is given, followed by the amount per credit hour for the fee:


Student_Service_ Fees       14.50   

Student_Union_Fee            30.00

Recreation_Fee                    20.00

Technology_Fee                  16.00

Health_Center_Fee             12.00                                     

·         The format of unique data in a single file for each student is as follows: 

o    The first line contains the student’s first name, last name, and  800 id number, all separated by spaces (no punctuation).

o    The second line contains the letters “UG” for an undergraduate student or “G” for a graduate student.

o    The third line contains the letter “R” for a resident student or “NR” for a non-resident student.

o    The fourth line contains an integer representing the number of credit hours the student is taking.


Part 2.  Modify the program you wrote for Part 1 by refining the amount charged for tuition, according to the following schedule:

·         Undergraduate Resident students are charged $143.70 per credit hour for tuition

·         Undergraduate Non-Resident students are charged $421.70 per credit hour for tuition

·         Graduate Resident students are charged $171.70 per credit hour for tuition  

·         Graduate Non-Resident students are charged $449.70 per credit hour for tuition 




For extra credit:

1.       At the end of the student data file, various optional fees may be listed for certain classes. These fees are a flat amount, and are not charged per credit hour. Examples of such fees are the following:


Art_Fee                  10.00

Lab_Fee                15.00

Music_Fee            20.00

PE_Fee                  14.00


Modify your program by adding a loop to continue reading and adding these fees to the total previously computed.  Your loop should work with varying numbers of optional fees (including the possibility of no optional fees).


2.       The maximum amount charged for Student Services Fees is $174.00, regardless of credit hours.  The maximum amount charged for the Technology Fee is $240.00, regardless of credit hours.  Modify your program to check if these two computed fee charges for the student (based on credit hours) have exceeded their maximum amounts; if so, charge only the maximum amounts.  


Homework assignment: on a separate sheet of paper, solve Ex. 2, 4, and 8 at the end of Chapter 7 (on pp. 429 and 431).

Deliverables: as instructed by your TA.