CIS 254 Intro to Object Oriented Program Design

Project 4.4

The phone company used the following rate structure for calls from San Francisco to Miami, Florida back in 1995:

  • Any call started at or after 6:00 pm (1800) but before 8:00 am (800.) is discounted 50%.
  • All calls are subject to a 4% federal tax.
  • The regular rate is $0.40 per minute.
  • Any call longer than 60 minutes receives a 15% discount on its cost (after any other discount is subtracted but before tax is added).

Write a program that reads from the user the start time for a call based on a 24-hour clock and the length of the call in minutes. The gross cost (before any discount or tax) should be printed, and then the net cost (after discounts and taxes).

Hint: in order to get the numbers to print with two digits after the decimal point, #include <iomanip> at the top of your program and use something like

cout << setprecision(2) << fixed << ....

You should use named constants whenever possible. The only number that should appear inside main() is the "2" in your setprecision(2).

Sample output 1:

    Enter start time: 2322
    Enter length of call in minutes: 67    
    The gross cost is $26.80
    The net cost is $11.85

Sample output 2:

    Enter start time: 759
    Enter length of call in minutes: 10    
    The gross cost is $4.00
    The net cost is $2.08

Sample output 3:

    Enter start time: 1300
    Enter length of call in minutes: 100    
    The gross cost is $40.00
    The net cost is $35.36

Sample output 4:

    Enter start time: 1300
    Enter length of call in minutes: 10    
    The gross cost is $4.00
    The net cost is $4.16