Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!