CS149 Algorithm
Development
|
|
Software Requirements Specification
Programming Assignment 3
Dukes ISP (Internet Service Provider) Billing
Due Tuesday, October 30 by 11:59pm (midnight)
Updated 10/26/2013
Introduction
Purpose: This programming
assignment is based on the assignment in your book, at the end of chapter 3.
Objectives - At
the conclusion of this exercise the student will demonstrate that they
can:
- Solve a problem involving decision structures.
- Use methods to structure the code.
- Validate input and use a default value if bad values entered.
- Use the
NumberFormat
or DecimalFormat
class or printf to properly format currency values.
- Do everything necessary to create, debug, and run
a java program.
- Use comments to delineate each section of the program.
- Adhere to a Style Guide.
- READ AND FOLLOW DIRECTIONS!!!!!
Deadlines
- Submit: October 30, 2013 by 11:59pm. Use WebCAT to submit this program.
- A 10 point per day late penalty will accrue for every day late:
- October 31 - 10 points
- Nov 1 - 20 points
- Nov 3 - 30 points
- Nov 4 - 40 points
- Nov 5 - 50 points
- Submissions after Nov 5 will not be accepted.
Problem description:
An Internet service provider has three different subscription packages
for its customers.
Package Charges:
Package |
Price per month |
Ceiling data transfer |
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:
- Prompt for the letter of the customer's package, A, B, or C
and read in the value.
- You must allow for either upper case or lower case
letters. 'A' and 'a' are equivalent.
- If a package other than A, B, or C is specified, display
an error message and use package A.
- Prompt for the number of hours of usage. This
number may be whole hours or parts of hours expressed as a decimal
number.
- If something other than a positive (or 0) number is
entered, display an error message and use 0.
- 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.
- Calculate the tax using the 5% rate. Display the
tax amount.
- Calculate the total bill and display this amount.
- Compare the total charge with the charge for the other
higher packages (A --> B and C, B --> C) and display
savings, of moving to the higher package.
Output
- Output the heading, "Dukes ISP Billing" followed by the
newline character.
- Output a blank line.
- Prompt for the input values. Note:
your input will be on the same line as the prompt.
- Your first input prompt must be the String, "Enter the
package code (A, B, or C): "
- Your second input prompt must be the String, "Enter the
number of hours used: "
- Error messages. If either of the first two reads
are invalid, display the message, "Your entry, " + badentryValue + "
is invalid. Using" , 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.
- 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.
- All money amounts should be displayed with $ symbol and
decimal point. The hours should be displayed to 2 decimal
points.
Customer Bill
<blank>
Package: packageCode
Hours Used: hours
<blank>
Base Charge: base
Base Hours: baseHours (omit this line for Package C)
Additional Hours: hours (omit this line for Package C)
<blank>
Total Charge: charge
Tax: taxCharge
<blank>
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. Savings displayed are the package savings and do not include taxes. 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. The italicized values are substitutions.
<blank>
You could have saved [savings] with package [packageCode]. Call 1-888-555-1234 for more information.
Additional Program Requirements - IMPORTANT
- You must have at least two classes, ISPBilling and ISPCharge. ISPBilling will hold the main
method and the
other will represent the individual 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.
- You must have two methods in ISPBilling for the input. The two methods must have the following headers:
- public static char readPackage(String prompt). This method should prompt the user and then read in the result. I would suggest that it return a char of either upper or lower case to simplify program coding.
- public static double readHours(String prompt). This method should prompt the user and then read in the result.
- You may add another class if you want and you may add methods to the ISPCharge.java or file if you want.
- 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.
- You must use named constants as appropriate.
- 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.
- 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.
- You may work with your LabPartner. If you have no lab partner, you may not consult with any other student in the class. Help may be obtained from the TAs.
- If you received no help your acknowledgement section should
have a statement to that effect. See they Style Guide for exact wording.
- Your program must conform to standard Java programming
standards and the additional standards for this class. See the Style
Guide for your class.
- You must submit a JUnit test file for ISPCharge.java, named ISPCharge_Test.java. See the JUnit lab for help.
- Recall that no method should be longer than 25 lines of code (this does not count whitespace or comments). Make additional helper methods as you need them.
Suggestions for building your solution
- Understand the problem. Make sure that you know which "player" will perform each of the actions in this assignment.
- Create "stubs" in ISPCharge.java and build a driver to test each method in isolation.
- 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?
- Implement each method.
- Test each of these methods using your driver before you try to incorporate them in the final working program.
- 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.
- Test each part thoroughly as you are building it.
- Pay attention to the interface.
- 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 other than your documented LabPartner.
Authorized help is limited to your textbook, the TA’s for any
CS139 or CS 149
section, and the professor for your section.
Grading
- Your program will be evaluated both by its correctness in calculating the charges and
conformance to the required elements.
- You will achieve a grade of 80 for a program that runs
correctly
and produces exactly the required output in the required format.
- The remainder (20) will be based on your conformance to the
Style and other requirements of the assignment. Review the Style Guide
before submitting your program and the grade sheet which is produced by
the submit system.
- All grades will be based on 100 points.
- You may submit any number of times. The only one I will
count is the one that corresponds to the last WebCAT submission.
- Successfully submitted programs that are late will be
graded, then the 20 point penalty assessed for each day late.
HINTS
- Begin early. Students run into trouble by waiting
too long to start the program.
- Understand the problem at hand. Make sure that
you follow
the requirements precisely. Don't add additional
"flourishes".
You will be downgraded.