CS139 Algorithm Development

Software Requirements Specification

Programming Assignment 2

Dukes ISP (Internet Service Provider) Billing

Due Tuesday, October 16 by 11:59pm (midnight) - Hardcopy in class Wednesday.


Introduction

Purpose: This programming assignment is based on the assignment in your book, pg 174-13 and 14.

Objectives - At the conclusion of this exercise the student will demonstrate that they can:

Deadlines

Problem description:

An Internet service provider has three different subscription packages for its customers.  

Package Charges:

Package Price per month Ceiling hours Additional hours
Package A $9.95 10 $2.00
Package B $13.95 20 $1.00
Package C 19.95 unlimited Not applicable

Your program should prompt for and read the package and the hours and calculate the cost to the user.  In addition, these packages are taxed by the locality at the rate of 5%.  Your program should calculate the tax on the total cost to the user and print a bill stating the package, the number of hours, the cost broken down by monthly price, hours, additional hours, and additional hours.  The format is specified below.

In addition, if the user has either package A or B, your bill should display a message if the user would have saved money under either of the other two plans. This savings should be displayed as the non-taxed amount.  If there would be no savings or if the user is on Package C, don't display a message.

Prerequisites

You understand the material in Chapter 3 and Chapter 5.1 of Gaddis.  

Program Behavior

Your application must do these things:

  1. Prompt for the letter of the customer's package, A, B, or C and read in the value. 
    1. You must allow for either upper case or lower case letters.  A and a are equivalent.
    2. If a package other than A, B, or C is specified, display an error message and re prompt the user and reread a value.
    3. If a package other than A, B, or C is specified a second time, display an error message and exit the program.
  2. Prompt for the number of hours of usage.  This number may be whole hours or parts of hours expressed as a decimal number.
    1. If something other than a positive (or 0) number is entered, display an error message and re prompt the user and reread a value.
    2. If something other than a positive (or 0) number is entered a second time, display an error message and exit the program.
  3. Based on the chart above (Package charges), display the total amount of the charges based on the description below in output and the chart above.
  4. Calculate the tax using the 5% rate.  Display the tax amount.  
  5. Calculate the total bill and display this amount.
  6. Compare the total charge with the charge for the other higher packages (A --> B and C, B --> C) and display savings, if any, of moving to the higher package.

Output

  1. Output the heading, "Dukes ISP Billing" followed by the newline character.
  2. Output a blank line.
  3. Prompt for the input values. Output the newline character after reading the each input value and before the next prompt. Note: your input will be on the same line as the prompt.
    1. Your first input prompt must be the String, "Enter the package code (A, B, or C): "
    2. Your second input prompt must be the String, "Enter the number of hours used: "
  4. Error messages.  If either of the first two reads are invalid, display the message, "Your entry, " + badentryValue + " is invalid. Please try again." , where badentryValue is the erroneous value read in on its own line.  You should then display the original prompt on a new line and re prompt with the original prompt.
  5. After reading all of the input values, output a blank line then the bill as follows.  The bold values are calculated values as described above. 
  6. All money amounts should be displayed with $ symbol and decimal point.  The hours should be displayed to 2 decimal points. 
Customer Bill

Package: packageCode
Hours Used: hours

Base Charge: base
Base Hours: baseHours (omit this line for Package C)
Additional Hours: hours (omit this line for Package C)
Total Charge: charge
Tax: taxCharge
Pay this Amount: totalBill

If the user is using package A or B and they could save money on package B or C, output a blank line and then the following message as appropriate.  Display two messages if two packages will provide savings.  If there is no savings or the savings would be on a lower base cost package, do not display the message.
You could have saved savings with package packageCode.  Call 1-888-555-1234 for more information.

Additional Program Requirements

  1. You must have at least two classes.  One class will hold the main method and the other will represent the charges.  All input and output will be done in the main method with methods in the ISPCharge.java class doing all of the calculations.  You must use this file for your "starter" and must fill out all of the listed methods.  Method headers must not be changed.  
  2. You may add another class if you want and you may add methods to the ISPCharge.java file if you want.
  3. ISPCharge will represent the charge for one customer.  It will store the package and hours, then use these values to calculate the various parts of the bill.
  4. You must use named constants as appropriate.
  5. You must display any error messages directly after the wrong input. For example, if the user enters an incorrect package code, you must immediately display the error message and reprompt for input.
  6. Your program must include an acknowledgement section acknowledging help received from TAs or reference sources. You do not need to reference receiving help from the instructor.  
  7. If you received no help your acknowledgement section should have a statement to that effect.  See they Style Guide for exact wording.
  8. Your program must conform to standard Java programming standards and the additional standards for this class. See the Style Guide for your class.

Suggestions for building your solution

  1. Understand the problem.  Make sure that you know which "player" will perform each of the actions in this assignment. 
  2. Create "stubs" in ISPCharge.java and build a driver to test each method in isolation.
  3. Design each of the methods before you code any of them.  What do you need to do, for example, to calculate the charge for package A?  What must you do to compare the charges?
  4. Implement each method.
  5. Test each of these methods using your driver before you try to incorporate them in the final working program.
  6. Design your final program.  What must happen first, second third?  Don't worry about error checking or the comparison part until you have it working with "expected" data and can produce a basic bill.
  7. Test each part thoroughly as you are building it.
  8. Pay attention to the interface.  This is not going through a submit test process, so you will need to make sure that your output conforms to these specifications.  Ask questions if there is any ambiguity.
  9. Document as you are going along.  The methods in ISPCharge should be updated to reflect the actual code you implement.  Document your steps in the main method.  

Honor Code

This work must conform to the JMU Honor Code and the specific requirements of this class. NO help may be provided by another student to another student. Authorized help is limited to your textbook, the TA’s for any CS139 section, and the professor for your section. See collaboration policy.

Grading

HINTS