1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
#include <iostream>
#include <string>
#include <limits>
using namespace std;
int main()
{
int monthlymins = 0, overA = 0, overB = 0, month = 0, minA, minB;
double planA, planB, costA = 0, costB = 0, totaloverA = 0, totaloverB, yearlyA = 0, yearlyB = 0;
cout << "Welcome to WireMore. Here you will be able to compare two plans, enjoy!.\n";
cout <<"Remember, there are no rollover minutes allowed, over minutes will be charged\n";
cout <<"0.35 cents per minute you go over" <<endl;
do
{
cout << "Please enter your monthly price for Plan A: $";
cin >> planA;
cout << "Enter the number of minutes allowed monthly for Plan A: ";
cin >> minA;
}while(planA <= 0 || minA <= 0 );
do
{
cout << "Please enter your monthly price for Plan B: $";
cin >> planB;
cout << "Enter the number of minutes allowed monthly for Plan B: ";
cin >> minA;
}while(planA <= 0 || minA <= 0 );
cout << "Please enter the number of minutes you used each month for the past 12 months:\n";
for (month = 1; month <=12; ++month )
{
do
{
cout << "Month " << month << ": ";
cin >> monthlymins;
}while (monthlymins, 0);
if (monthlymins > minA)
{
overA += (monthlymins - minA);
}
if (monthlymins > minA)
{
overB += (monthlymins - minB);
}
}
costA = planA * 12;
totaloverA = overA * .35;
costB = planB * 12;
totaloverB = overB * .35;
yearlyA = costA + totaloverA;
yearlyB = costB + totaloverB;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
if(costA < costB)
{
cout << "The plan best suited for you is Plan A,"<<endl;
cout <<"Which totals yearly to: $" << yearlyA <<endl;
cout << " You will save, " << ( yearlyB - yearlyA ) << " ,by using Plan A instead!!";
}
else
{
cout << "The plan best suited for you is Plan B, "<<endl;
cout <<"Which totals yearly to: $" << yearlyB <<endl;
cout << " You will save " << (yearlyA-yearlyB) << " by using Plan B instead!!\n";
}
cout << "Thanks for using the Comparison Computer.\n";
cout << "Press ENTER to quit.";
cin.get();
getchar();
return 0;
}
|