Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Rewrite this program (Chapter 4, Problem 1 programming assignment) that calculates and prints the bill for a cellular telephone company as a modular

In C++

Rewrite this program (Chapter 4, Problem 1 programming assignment) that calculates and prints the bill for a cellular telephone company as a modular program. The company offers two types of service: regular and premium. Its rates vary, depending on the type of service. The rates are computed as follows:

Regular service: $10.00 plus first 50 minutes are free. Charges for over 50 minutes are $0.20 per minute. 
Premium service: $25.00 plus: 
For calls made from 6:00 a.m. to 6:00 p.m., the first 75 minutes are free; charges for more than 75 minutes are $0.10 per minute. 
For calls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes are free; charges for more than 100 minutes are $0.05 per minute. 

Your program should prompt the user to enter an account number, a service code (type char), and the number of minutes the service was used. 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 output the account number, type of service, number of minutes the telephone service was used, and the amount due from the user. For the premium service, the customer may be using the service during the day and the night. Therefore, to calculate the bill, you must ask the user to input the number of minutes the service was used during the day and the number of minutes the service was used during the night.

[This is the metioned code to reform]

#include #include #include using namespace std;

int account_number; float minutes; char service; float amount_due; float day_min; float night_min; float regular(); float premium(); int main() {

cout<< "Please enter your account number: " ; cin >> account_number; cout<< "Do you have Regular service or Premium service (r or p)? "; cin >> service; // cout<< service <

} float premium() {

cout<< "How many minutes were used during the day? "; cin >> day_min; cout<< "How many minutes were used during the night? "; cin >>night_min; if (day_min > 75) { amount_due = ((day_min - 75) * .10)+ 25.00; } if (night_min > 100) { amount_due = ((day_min - 100) * .05)+ 25.00; } amount_due = amount_due + 25.00; cout<< fixed << showpoint << setprecision(2); cout<< "Amount due: $" << amount_due << endl; cout<< "Account number: "<< account_number <

return 0; } float regular () { cout<< "How many minutes were used? "; cin >> minutes; if (minutes <= 50.00) { amount_due = 10.00; cout<< fixed << showpoint << setprecision(2); cout<< "Amount due: $" << amount_due << endl; cout<< "Account number: "<< account_number <

} else { amount_due = ((minutes -50.00) * 0.20); cout<< setw(2) << showpoint << setprecision(3)<< "Amount due: $"<< amount_due << endl; cout<< "Account number: "<< account_number <

}

Please have:

structure chart as a screen shot or picture

source code for with

The name of program as a comment at the top of the file

IPO chart incorporated as comments after the name of the file

IPO charts for your functions as comments before the prototypes of your functions

A screen shot or picture of the results after running your program with your test data

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe several ways to identify high-potential employees.

Answered: 1 week ago