Question: Problem #2 (20 points) Write a Java program (name it PhoneBill Yourname ) that calculates the bill for a cellular telephone company. The company offers

Problem #2 (20 points)

Write a Java program (name it PhoneBillYourname) that calculates the bill for a cellular telephone company. The company offers two types of service: regular and premium. The rates vary depending on the type of service. The rates are computed as follows:

Regular service: $15.00 fee plus first 60 minutes free. Charges for over 60 minutes are computed at the rate of $0.25 per minute.

Premium service: $25.00 fee plus

a. For daytime calls (between 6:00AM to 6:00PM), the first 75 minutes are free; charges for over 75 minutes are computed at the rate of $0.08 per minute.

b. For nighttime calls (between 6:00PM to 6:00AM), the first 100 minutes are free; charges for over 100 minutes are computed at the rate of 0.03 per minute.

Your program should prompt the user to enter an account number, a service code (integer type), and the number of minutes the service was used. A service code 0(integer number 0) means regular service; while code 1(integer number 1) means premium service.

For the premium service (code 1), the customer may be using the service during both the day and at night. Therefore, you must ask the user to input the number of minutes used during daytime and night time.

The program should output, on separate lines and with proper labels, the account number, service type, number of minutes the service was used, and the bill amount due from the user as shown below. Sample test data below does not show the input prompts. (Input will be an account number, service type, minute. For premium, you must get two values for daytime and nighttime)

First test (result):

Account Number: 12345 Service type: Regular Total minutes: 63 Amount due: $15.75

Second test (result):

Account Number: 1234567 Service type: Premium Daytime minutes: 77 Nighttime minutes: 103 Amount due: $25.25

I recommend you using constants (final) to keep static values such as basic fee, free minutes, rates, and so on.

please i need help with yhis question

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!