#include using namespace std; int main() {int hours; char pack; double tot; cout
ID: 3639255 • Letter: #
Question
#include
using namespace std;
int main()
{int hours;
char pack;
double tot;
cout<<"Make a Selection ";
cout<<"(A)Package A ";
cout<<"(B)Package B ";
cout<<"(C)Package C ";
cout<<"Enter your selection: ";
cin>>pack;
cout<<"Enter hours: ";
cin>>hours;
if(hours>744)
cout<<"That's more hours then in a month!! ";
else
{switch(pack)
{case 'A': if(hours<10)
tot=9.95;
else
tot=9.95+(hours-10)*2;
break;
case 'B': if(hours<20)
tot=14.95;
else
tot=14.95+(hours-20);
break;
case 'C': tot=19.95;
}
}
cout<<"Monthly Bill: $"<system("pause");
return 0;
}
------------------------------------------
Using the code provided ((Code is above)), make simple modifications. Both part A & B are to be added to the code. Part "A" is going to be type, part "B" is going to be in a picture of the exercise. Please contact me with any questions.
Part A:
Modify the Program (program is above) so that it also displays how much money Package A customers would save if they purchased packages B or C, and how much money Package B customers would save if they purchased Package C. If there would be no savings, no message should be printed.
Part B:
Months with 30 days have 720 hours, and months with 31days have 744 hours. February, with 28 days, has 672 hours. Enhance the input validation of the Internet Service Provider program by asking the user for the month (by name), and validating that the number of hours entered is not more than the maximum for the entire month. Here is a table of the months, their days, and number of hours in each.
((I will give fast, full credit who can help me ASAP with this two part question.))
Explanation / Answer
please rate - thanks
#include <iostream>
using namespace std;
int main()
{int hours,month,max;
char pack;
double totA,totB,totC;
cout<<"Enter the month for this bill. "<<"1. January 7. July "
<<"2. February 8. August "<<"3. March 9. September "
<<"4. April 10. October "<<"5. May 11. November "
<<"6. June 12. December >>";
cin>>month;
while(month<1||month>12)
{cout<<"invalid entry ";
cout<<"Enter the month for this bill. "<<"1. January 7. July "
<<"2. February 8. August "<<"3. March 9. September "
<<"4. April 10. October "<<"5. May 11. November "
<<"6. June 12. December >>";
}
switch(month)
{case 4: case 6: case 9: case 11:
max=720;
break;
case 2: max=672;
break;
default: max=744;
}
cout<<"Make a Selection ";
cout<<"(A)Package A ";
cout<<"(B)Package B ";
cout<<"(C)Package C ";
cout<<"Enter your selection: ";
cin>>pack;
cout<<"Enter hours: ";
cin>>hours;
if(hours>max)
cout<<"That's more hours then in a month!! ";
else
{ if(hours<10)
totA=9.95;
else
totA=9.95+(hours-10)*2;
if(hours<20)
totB=14.95;
else
totB=14.95+(hours-20);
totC=19.95;
}
switch (pack)
{case 'A':cout<<"Monthly Bill: $"<<totA<<endl;
cout<<"if had chosen package B would have saved $"<<totA-totB<<endl;
cout<<"if had chosen package C would have saved $"<<totA-totC<<endl;
break;
case 'B':cout<<"Monthly Bill: $"<<totB<<endl;
cout<<"if had chosen package C would have saved $"<<totB-totC<<endl;
break;
case 'C':cout<<"Monthly Bill: $"<<totC<<endl;
break;
}
system("pause");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.