Order now
     

Description: to calculate the call cost.

I am working on project 5 on ch 3 of book Solving Problems C++

I tried to write the code but I could not fix the do while loop to repeat the program if the user would like to repeat.

Here are my codes:

//Project #: 5 on Chapter 3

//Description: to calculate the call cost.

//Last Changed: Sunday 18 October 2015

#include <iostream>

using namespace std;

int main()

{

//variable declaration

int hours, minutes, call_duration;

char day1, repeat;

do {

cout << ” Enter the day of the Call, please! ” << endl;

cout << ” Press M for Monday ” << endl;

cout << ” Press T for Tuesday ” << endl;

cout << ” Press W for Wednesday ” << endl;

cout << ” Press H for Thursday ” << endl;

cout << ” Press F for Friday ” << endl;

cout << ” Press S for Saturday” << endl;

cout << ” Press U for Sunday” << endl;

cin >> day1;

cout << “Enter the time in hours” << endl;

cin >> hours;

cout << “Enter the time in minutes” << endl;

cin >> minutes;

cout << “Enter the time of call duration in minutes” << endl;

cin >> call_duration;

// to check if the entry is correct or not…

if  (  (day1 != ‘m’)&& (day1 != ‘M’)

&& (day1 != ‘t’)&& (day1 != ‘T’)

&& (day1 != ‘w’)&& (day1 != ‘W’)

&& (day1 != ‘h’)&& (day1 != ‘H’)

&& (day1 != ‘f’)&& (day1 != ‘F’)

&& (day1 != ‘s’)&& (day1 != ‘S’)

&& (day1 != ‘u’)&& (day1 != ‘U’))

{

cout << “Wrong Entry!” << endl;

}

// if the Entry is correct..

else if ((day1 == ‘m’)&& (day1 == ‘M’)

|| (day1 == ‘t’) || (day1 == ‘T’)

|| (day1 == ‘w’) || (day1 == ‘W’)

|| (day1 == ‘h’) || (day1 == ‘H’)

|| (day1 == ‘f’) || (day1 == ‘F’))

{

if ((hours >= 8) && (hours < 18))

{

cout << “The cost of your call is $ ” << (0.40 * call_duration) << endl;

}

else

{

cout << “The cost of your call is $ ” << (0.25 * call_duration) << endl;

}

} //IF the call was during the midweek LOP CLOSING

else  //IF the call was during the weekend LOP OPENING

{

cout << “The cost of your call is $ ” << (0.15 * call_duration)<< endl;

} //IF the call was during the weekend LOP CLOSING

cout << ” Do you want to repeat this program?” << endl;

cout << ” Press Y for YES or press any key to quit the program!! ” << endl;

} while ((repeat == ‘Y’) || (repeat == ‘y’));   //do while to let the program repeated if the user wish (loop CLOOSING)

return 0;

} // main loop CLOSING

Would u like to fix the codes for do while in order to repeat the program if the user wish,  please??

Would u like to check the codes please??

Place a similar order with us or any form of academic custom essays related subject and it will be delivered within its deadline. All assignments are written from scratch based on the instructions which you will provide to ensure it is original and not plagiarized. Kindly use the calculator below to get your order cost; Do not hesitate to contact our support staff if you need any clarifications.

Type of paper Academic level Subject area
Number of pages Paper urgency Cost per page:
 Total:

Whatever level of paper you need – college, university, research paper, term paper or just a high school paper, you can safely place an order.