Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- // plan rates
- const float planA = 39.99;
- const float planB = 59.99;
- const float planC = 69.99;
- // minutes allowed per plan
- const int limitA = 450;
- const int limitB = 900;
- // rates for additional minutes
- const float additionalMinutesA = 0.45;
- const float additionalMinutesB = 0.40;
- // choose plan
- float plan;
- // total minutes used
- float totalMinutes;
- // amount charged
- float amountChargedA = (totalMinutes - limitA) * additionalMinutesA;
- float amountChargedB = (totalMinutes - limitB) * additionalMinutesB;
- float amountChargedC = planC;
- cout << "Voice plans: " << endl;
- cout << "A. The 450 minute plan" << endl;
- cout << "B. The 900 minute plan" << endl;
- cout << "C. The unlimited plan" << endl;
- cout << "Enter which voice plan the customer subscribes to: ";
- cin >> plan;
- cout << "Enter the total number of minutes used during the month: ";
- cin >> totalMinutes;
- cout << endl;
- if (planA) {
- cout << "The amount due for the month is $" << amountChargedA << endl;
- cout << "Amount saved if you were on Plan B: $" << (amountChargedA - amountChargedB) << endl;
- cout << "Amount saved if you were on Plan C: $" << (amountChargedA - amountChargedC) << endl;
- }
- else if (planB) {
- cout << "The amount due for the month is $" << amountChargedB << endl;
- cout << "Amount saved if you were on Plan C: $" << (amountChargedB - amountChargedC) << endl;
- }
- else if (planC) {
- cout << "The amount due for the month is $" << amountChargedC << endl;
- }
- else (plan != planA || plan != planB || plan != planC); {
- cout << "The voice plan entered is invalid." << endl;
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement