Write a program that calculates and prints the bill for a telephone and cable co
ID: 3557929 • Letter: W
Question
Write a program that calculates and prints the bill for a telephone and cable company. The company offers two types of cable service: Basic and VIP. Its rates vary, depending on the type of service. The rates are computed as follows:
Basic Service:
Bill Processing Fee: $5.75
Service Fee: $45.50
Premium Channels: $7.50 per channel for the first 2 channels, $11.50 for each additional channel
VIP Service:
Bill Processing Fee: $5.75
Service Fee: $45.50
VIP Service Fee: $10
Premium Channels: $7.50 per channel for the first 4 channels, $10.75 for each additional channel
The company also offers two types of telephone service: regular and premium. Its rates vary, depending on the type of service. The rates are computed as follows:
Regular Service:
$20 plus:
the first 65 minutes are free. Charges for over 65 minutes are $0.20 per minute.
Premium Service:
$45 plus:
For calls made from 6:00 am to 6:00 pm, the first 85 minutes are free; charges over 85 minutes are $0.10 per minute.
For calls made from 6:00 pm to 6:00 am, the first 100 minutes are free; charges for over 100 minutes are $0.05 per minute.
A customer can have either the telephone or cable service or both. Your program should prompt the user to enter an account number, a cable service code of type char, the number of premium channels to which the user subscribes, a telephone service code of type char, and the number of minutes the telephone service was used. For the cable service, a service code of b or B means basic service; a service code of v or V means VIP service. For the telephone service, a service code of r or R means regular service; a service code of p or P means premium service. Treat any other character as an error. Your program should inform the user of the error then ask the user to re-enter the code repeatedly until a correct code is given. Your program should output to a file, "output.txt", the account number, type of cable service, number of premium channels, type of telephone service, number of minutes the telephone service was used, and the amount due from the user.
Your program should only get the relevant input and output the corresponding values for the services which the user has.
Test your program with the following data:
Explanation / Answer
01 # 02 include 03 #include 04 05 06 using namespace std; 07 08 const double REG_CHARGES = 10.00; 09 const int REG_MINUTES = 50; 10 const double REG_RATE_OVER_50 = 0.20; 11 12 const double PREM_SERV_CHARGES = 25.00; 13 const int PREM_FREE_DAY_MINUTES = 75; 14 const double PREM_DAY_RATE_OVER_75 = 0.10; 15 16 const int PREM_FREE_NIGHT_MINUTES = 100; 17 const double PREM_NIGHT_RATE_OVER_100 = 0.05; 18 19 double regular(); 20 double premium (); 21 22 int main(void) 23 { 24 25 //Variable Declaration 26 int account,minutes; 27 char service_type; 28 double amount_due=0 29 30 coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.