An Internet service provider has three different subscription packages for its customers:
Package A: For $9.95 per month 10 hours are provided. Additional hours are $2.00 per hour.
Package B: For $13.95 per month 20 hours are provided. Additional hours are $1.00 per hour.
Package C: For $19.95 per month unlimited access is provided
Due to increases in delivery of service to certain markets the Internet service provider is adding a surcharge based
upon the customer’s zip code. If the first digit of the zip code is ‘3’ then the additional surcharge is $1.50. If the
first digit of the zip code is ‘5’ then the additional surcharge is $1.75. Finally, if the first digit of the zip code is ‘8’
then the additional surcharge is $1.95. See notes below for helpful comments for completing this requirement:
See page 88 under the section, Reading a Character, and the combination of the nextLine() and
charAt() methods for retrieving a single character using its position within a string. In order to use the
charAt() method the zip code must be a String object OR . . .
Zip code can be declared as a numeric data type and the starting value of 3, 5, or 8, can be determined
without the use of the nextLine() and charAt() methods
Currently the Internet Service Provider is providing a discount for customers in specific counties. Customers in
Comanche County receive a 5% discount, Parker County customers receive a 10% discount, and customers in
Erath County receive a 20% discount. The discount amount is applied to the total charge.
Write a program that calculates a customer’s monthly bill. It should ask the user to enter the number of hours
that were used, their zip code, their county, and the letter of the package the customer has purchased (A, B, or C).
It should then display the base charge for the selected package, additional charges based upon hours used (if
applicable), the surcharge based upon the customer’s zip code, the subtotal for the selected package, the
discount amount (may be zero), and the total charges for the selected package. The program should include the
following functionality related to validation and input using the appropriate decision structure (please avoid the
use of the System.exit() method – all decision structures must end naturally at this point):
The number of hours must be greater than zero otherwise an appropriate message is displayed and the
The first character of the zip code must be greater than zero otherwise an appropriate message is
displayed and the program ends
The county name must be entered (i.e., cannot be blank) otherwise an appropriate message is displayed
and the program ends
The user should be able to enter the county name in uppercase, lowercase, or mixed case.
If an incorrect package letter is entered the program should display an error message to the user and the
The program should allow the user to enter either an uppercase or lowercase character for the package
Additionally, the program should also calculate and display the amount of money Package A customers would
save if they purchased Package B or C, and the amount of money Package B customers would save if they
purchased Package C. If there would be no savings, no message should be printed.
Named constants should be used for the cost of each subscription package so that they can easily be updated if
they change in the future. Please follow the naming convention provided in the textbook on page 69.
You may use either console or dialog box input/output, but please be consistent in their use (i.e., please do not
mix at this time).
All monetary output should be formatted using String.Format (6th ed., 3.10, p. 164) or DecimalFormat class (5th
ed., 3.11, p. 174) to display as currency (i.e., leading dollar sign, appropriate comma(s), and two-decimal places).
Use the horizontal tab escape sequence (see Table 2-2, p. 37) to format output to line up appropriately