Friday, 30 November 2018

Problem Set 3. Mobile Service Provider - Part 3 | Asad Ali


Problem Set 3. Mobile Service Provider - Part 3


/// Problem Set 3. Mobile Service Provider - Part 2

#include <iostream>
#include <string>
using namespace std;
int main()
{
string month;
char choice;
int mins, extramins;
double extraCharges, dueAmount, saved_B, saved_C;
cout << "\t\t\t\tMobile Service Provider" << endl;
cout << "--------------------------------------------------------------------------------------------------" << endl;
cout << "Package A: For $39.99 per month 450 minutes are provided. Additional minutes are $0.45 per minute." << endl;
cout << "Package B: For $59.99 per month 900 minutes are provided. Additional minutes are $0.40 per minute." << endl;
cout << "Package C: For $69.99 per month unlimited minutes provided." << endl;
cout << "--------------------------------------------------------------------------------------------------" << endl;
cout << "Choose a package out of A, B and C : ";
cin >> choice;
switch ( choice )
{
case 'A':
case 'a':
cout << "How many minuts you used : ";
cin >> mins;
cout << "Wright the name of the month : ";
cin >> month;
if ( month == "January" || month == "March" || month == "May" || month == "July" || month == "August" || month == "October" || month == "December" )
{
if ( mins <= 744 * 60 )
{
if ( mins <= 450 && mins > 0 )
{
cout << "Total amount due : $39.99" << endl;
}
else if ( mins > 450 && mins <= 900 )
{
extramins = mins - 450;
extraCharges = extramins * 0.45;
dueAmount = 39.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_B = dueAmount - 59.99;
if ( saved_B > 0 )
{
cout << "You would saved about $" << saved_B << " if you had choosed Package B." << endl;
}
}
else if ( mins > 900 )
{
extramins = mins - 450;
extraCharges = extramins * 0.45;
dueAmount = 39.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_C = dueAmount - 69.99;
if ( saved_C > 0 )
{
cout << "You would saved about $" << saved_C << " if you had choosed Package C." << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. January, March, May, July, August, October, December have only " << 744 * 60 << " minuts at most." << endl;
}
}
if ( month == "April" || month == "June" || month == "September" || month == "November" )
{
if ( mins <= 720 * 60 )
{
if ( mins <= 450 && mins > 0 )
{
cout << "Total amount due : $39.99" << endl;
}
else if ( mins > 450 && mins <= 900 )
{
extramins = mins - 450;
extraCharges = extramins * 0.45;
dueAmount = 39.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_B = dueAmount - 59.99;
if ( saved_B > 0 )
{
cout << "You would saved about $" << saved_B << " if you had choosed Package B." << endl;
}
}
else if ( mins > 900 )
{
extramins = mins - 450;
extraCharges = extramins * 0.45;
dueAmount = 39.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_C = dueAmount - 69.99;
if ( saved_C > 0 )
{
cout << "You would saved about $" << saved_C << " if you had choosed Package C." << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. April, June, September, November December have only " << 744 * 60 << " minuts at most." << endl;
}
}
if ( month == "February" )
{
if ( mins <= 672 * 60 )
{
if ( mins <= 450 && mins > 0 )
{
cout << "Total amount due : $39.99" << endl;
}
else if ( mins > 450 && mins <= 900 )
{
extramins = mins - 450;
extraCharges = extramins * 0.45;
dueAmount = 39.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_B = dueAmount - 59.99;
if ( saved_B > 0 )
{
cout << "You would saved about $" << saved_B << " if you had choosed Package B." << endl;
}
}
else if ( mins > 900 )
{
extramins = mins - 450;
extraCharges = extramins * 0.45;
dueAmount = 39.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_C = dueAmount - 69.99;
if ( saved_C > 0 )
{
cout << "You would saved about $" << saved_C << " if you had choosed Package C." << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. February has only " << 744 * 60 << " minuts at most." << endl;
}
}
break;
case 'B':
case 'b':
cout << "How many minuts you used : ";
cin >> mins;
cout << "Wright the name of the month : ";
cin >> month;
if ( month == "January" || month == "March" || month == "May" || month == "July" || month == "August" || month == "October" || month == "December" )
{
if ( mins <= 744 * 60 )
{
if ( mins > 0 )
{
if ( mins <= 900 && mins > 450 )
{
cout << "Total amount due : $59.99" << endl;
}
else if ( mins > 900 )
{
extramins = mins - 900;
extraCharges = extramins * 0.40;
dueAmount = 59.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_C = dueAmount - 69.99;
if ( saved_C > 0 )
{
cout << "You would saved about $" << saved_C << " if you had choosed Package C." << endl;
}
else
{
// display nothing
}
}
else if ( mins <= 450 && mins > 0 )
{
dueAmount = 59.99 + extraCharges;
cout << "You would saved about $" << dueAmount - 39.99 << " if you had choosed Package A." << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. January, March, May, July, August, October, December have only " << 744 * 60 << " minuts at most." << endl;
}
}
if ( month == "April" || month == "June" || month == "September" || month == "November" )
{
if ( mins <= 720 * 60 )
{
if ( mins > 0 )
{
if ( mins <= 900 && mins > 450 )
{
cout << "Total amount due : $59.99" << endl;
}
else if ( mins > 900 )
{
extramins = mins - 900;
extraCharges = extramins * 0.40;
dueAmount = 59.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_C = dueAmount - 69.99;
if ( saved_C > 0 )
{
cout << "You would saved about $" << saved_C << " if you had choosed Package C." << endl;
}
else
{
// display nothing
}
}
else if ( mins <= 450 && mins > 0 )
{
dueAmount = 59.99 + extraCharges;
cout << "You would saved about $" << dueAmount - 39.99 << " if you had choosed Package A." << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. April, June, September, November December have only " << 744 * 60 << " minuts at most." << endl;
}
}
if ( month == "February" )
{
if ( mins <= 672 * 60 )
{
if ( mins > 0 )
{
if ( mins <= 900 && mins > 450 )
{
cout << "Total amount due : $59.99" << endl;
}
else if ( mins > 900 )
{
extramins = mins - 900;
extraCharges = extramins * 0.40;
dueAmount = 59.99 + extraCharges;
cout << "Total amount due : $" << dueAmount << endl;
saved_C = dueAmount - 69.99;
if ( saved_C > 0 )
{
cout << "You would saved about $" << saved_C << " if you had choosed Package C." << endl;
}
else
{
// display nothing
}
}
else if ( mins <= 450 && mins > 0 )
{
dueAmount = 59.99 + extraCharges;
cout << "You would saved about $" << dueAmount - 39.99 << " if you had choosed Package A." << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. February has only " << 744 * 60 << " minuts at most." << endl;
}
}
break;
case 'C':
case 'c':
cout << "How many minuts you used : ";
cin >> mins;
cout << "Wright the name of the month : ";
cin >> month;
if ( month == "January" || month == "March" || month == "May" || month == "July" || month == "August" || month == "October" || month == "December" )
{
if ( mins <= 744 * 60 )
{
if ( mins > 0 )
{
if ( mins > 450 && mins <= 900 )
{
cout << "You should choose Package B. In this way you would save about $10." << endl;

}
else if ( mins <= 450 )
{
cout << "You should choose Package A. In this way you would save about $30." << endl;
}
else
{
cout << "Total amount due : $69.99" << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. January, March, May, July, August, October, December have only " << 744 * 60 << " minuts at most." << endl;
}
}
if ( month == "April" || month == "June" || month == "September" || month == "November" )
{
if ( mins <= 720 * 60 )
{
if ( mins > 0 )
{
if ( mins > 450 && mins <= 900 )
{
cout << "You should choose Package B. In this way you would save about $10." << endl;

}
else if ( mins <= 450 )
{
cout << "You should choose Package A. In this way you would save about $30." << endl;
}
else
{
cout << "Total amount due : $69.99" << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. April, June, September, November December have only " << 744 * 60 << " minuts at most." << endl;
}
}
if ( month == "February" )
{
if ( mins <= 672 * 60 )
{
if ( mins > 0 )
{
if ( mins > 450 && mins <= 900 )
{
cout << "You should choose Package B. In this way you would save about $10." << endl;

}
else if ( mins <= 450 )
{
cout << "You should choose Package A. In this way you would save about $30." << endl;
}
else
{
cout << "Total amount due : $69.99" << endl;
}
}
else
{
cout << "ERROR!" << endl;
}
}
else
{
cout << "You have entered impossible number of minuts. February has only " << 744 * 60 << " minuts at most." << endl;
}
}
break;
default:
cout << "ERROR!" << endl;
break;
}
return 0;
}

/// Code by Asad Ali and officially posted on padacode.blogspot.com

Please help me improve my work by letting me know about mistakes (if any) I mad in the project given above, by commenting on the particular post.
Share:

0 comments:

Post a Comment

Thanks for visiting my Blog.

Have any problem, feel free to contact us via Email: asadalipkp9@gmail.com

Have a nice day!

padacode.blogspot.com

Powered by Blogger.