Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What wrong with this code? How do I fix TimeStarted variable? C++ #include #include using namespace std; int main(int argc, char* argv[]) { const double

What wrong with this code? How do I fix "TimeStarted" variable? C++

#include #include using namespace std; int main(int argc, char* argv[]) { const double WEEKEND_RATE = 0.15; const double EVENING_RATE = 0.25; const double DAY_RATE = 0.40; char day1; char day2; int hour; char separator; int minute; int LengthOfCall; char again; int TimeStarted; double billingRate; double CostOfCall; { cout << "Enter the day (Mo Tu We Th Fr Sa Su):"; cin >> day1 >> day2; day1 = toupper(day1); day2 = toupper(day2);

cout << "Enter the time started (ex: 14:35):"; cin >> hour >> separator >> minute;

cout << "Enter the length of the call in minutes: "; cin >> LengthOfCall;

if (day1 == 'S' && day2 == 'A') billingRate = WEEKEND_RATE; else if (day1 == 'S' && day2 == 'U') billingRate = WEEKEND_RATE; else { if (TimeStarted>= 800 && TimeStarted<= 1800) billingRate = DAY_RATE; else billingRate = EVENING_RATE; } CostOfCall = LengthOfCall * billingRate; cout << "Another call (Y/N)?"; cin >> again; again = toupper(again); } while (again == 'Y'); 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

More Books

Students also viewed these Databases questions

Question

What does the start( ) method defined by Thread do?

Answered: 1 week ago

Question

5. Tell how job experiences can be used for skill development.

Answered: 1 week ago

Question

4. Explain the characteristics of successful mentoring programs.

Answered: 1 week ago