Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the code I did to also display this at the end after the user inputs everything ..... Your program will read input from

I need the code I did to also display this at the end after the user inputs everything .....

Your program will read input from a file that contains records of calls. Each call record consists of the day of the week, the time the call started, and the length of the call in minutes, as shown below:

Mo 13:30 16

Mo 8:15 35

Tu 7:50 20

We 17:45 30

Th 8:00 45

Su 23:50 30

This is my code:

#include #include #include #include

using namespace std;

int main() { int minutes, startTime; char ch; string Day; double cost, rate; cout << fixed << showpoint << setprecision (2); do { cout << "Enter start time of the call (For example, 2:30 = 2330): "; cin >> startTime; while(startTime < 0 || startTime >= 2400) { cout << " Invalid time."; cout << "Enter start time of the call(For example, 2:30 = 2330): "; cin >> startTime; } cout << "Enter how long call was in minutes: "; cin >> minutes; cout << "Enter the day of the week (write first two letters of the day for example Monday is Mo):"; cin >> Day; if(Day == "Mo"|| Day == "MONDAY" || Day == "Tu" || Day == "TUESDAY" || Day =="We" || Day == "WEDNESDAY" || Day =="Th" || Day == "thursday" || Day == "Fr" || Day =="FRIDAY") { if (startTime >= 800 && startTime <= 1800) rate = 0.4; else rate = 0.25; cost = minutes * rate; cout << " Rate for the call was " << "$" << rate << " a minute"<< endl << "Your total cost: " << "$" << cost << endl; } else if(Day =="Sa" || Day =="SATURDAY" || Day =="Su" || Day =="SUNDAY") { rate = 0.15; cost = minutes * rate; cout << "/The rate for your call was " << "$"<< rate << " a minute"<< endl << "Your total cost is: " << "$" << cost; } else cout << " Invalid."; cout << endl << " Would you like to calculate your bill again? (y/n): "; cin >> ch; cout << endl << endl;

} while( ch =='Y' || ch == 'y'); cout << " Thank you, please come again. "; return 0; }

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

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions