Project 3
Spring 2007
Implementation due Tue, Mar 27 @ 5 PM
8 points
Hoya Saxa (HS) Wireless engaged you to write their billing software. Wireless customers subscribe to a plan, which affords a certain number of SMS messages and in-network and out-of-network minutes. The Hoya plan costs $35 per month and provides 300 in-network minutes, 100 out-of-network minutes, and 25 SMS messages. If subscribers exceed their plan's limitations, then they pays ten cents per in-network minute, twenty center per out-of-network minute, and twenty-five cents per SMS message.
The Saxa plan costs $65 per month and provides 300 in-network minutes, 300 out-of-network minutes, and 50 SMS messages. For exceeding the plan's limitation, subscribers pay fifteen cents per minute for in-network and out-of-network minutes, and pay twenty-five cents per SMS message.
Naturally, all of these values are subject to change, so your program should make such changes easy to implement. Finally, there is an 8% Federal tax added to each bill.
Your program should read a subscriber's monthly activity from a file and calculate his or her monthly charge. The first field in the file is the subscriber's plan, which should be the string "Hoya" or "Saxa". It is followed by a number of records, which start with a transaction code of 'I' for in-network calls, 'O' for out-of-network calls, and 'S' for SMS messages. For phone calls, the next field of the record is the number of minutes of the call. There is no such field for SMS messages. An example of a transaction file is:
Hoya S I 45 I 10 S O 20Your program should read files in this format, perform error checks, and calculate and print the subscriber's monthly bill.
At the very least, you should implement three functions that calculate overage costs for SMS messages and in-network and out-of-network phone calls. Naturally, these functions must take into account the two different plans. Global constants are fine; global variables are not. The program should always read from the file p3.dta. We'll release a sample data set on March 22.
Hints for development. SMS messages are the easiest transaction to handle, so I would start by creating a data file of only SMS messages for one plan. Get your program working for this input without using functions. Then modify the program so a function computes any overage costs for SMS messages. Then modify the program so it will handle SMS messages for the other plan. Then modify the program so it will calculate in-network calls for a single plan with and then without overage charges. Proceed in this fashion until the program works for all inputs.
/** * Project 3 * Name: <your name> * E-mail: <e-mail address> * COSC 071, Spring 2007 * * In accordance with the class policies and Georgetown's Honor Code, * I certify that, with the exceptions of the lecture notes and those * items noted below, I have neither given nor received any assistance * on this project. * * Description: <Describe your program> */
When you are ready to submit your program for grading, use the submit program. Both submit.jar and the file containing your program should be in the same directory. This assignment's label is p3, so the form of the submit command is
seva% java -jar submit.jar -a p3 -f <file>Assuming the file you want to submit is p3.cc, then to submit you enter the command
seva% java -jar submit.jar -a p3 -f p3.ccMake sure you submit the file containing your program's source, not its executable code; that is, do not submit a.out.
Once you've submitted your project, it is a good idea to keep a copy on seva, which preserves the modification date and time and ensures that you will have a backup copy of your project. If we lose your project or submit breaks, then we will need to look at the modification date and time of your project to ensure that you submitted it before it was due.
The TAs who will be grading your projects this semester are listed on the main page. You must submit your project before 5 PM on the due date.
seva% mail -s "<netid>.cc" cosc071@cush < <filename>Assume that I want to submit my file named p3.cc. Then I would type
seva% mail -s "maloofm.cc" cosc071@cush < p3.ccThis command sends mail with the subject "maloofm.cc" to our grading account (cosc071@cush). The body of the e-mail is the contents of the file p3.cc. Use Plan B only if you have made sure that submit is truly broken. Finally, don't send normal mail to this account because no one will be checking it regularly.