Plan A, 400 minutes : amount due is $39.99
Plan A, 480 minutes : amount due is $53.49
Plan B, 900 minutes : amount due is $59.99
Plan B, 920 minutes : amount due is $67.99
Plan C, 1000 minutes: amount due is $69.99
these are the results i need.
when i put in plan a with 100 and 480 minutes it works perfect.
when i put 900 minutes is when things go wrong and i get this:
Talk Plans:
A. The 450 minute plan
B. The 900 minute plan
C. The unlimited plan
Enter which talk plan the customer subscribes to:
b
Enter the total number of minutes used during the month
900
The amount due for the month is $242.49 //should be $59.99
Program ended with exit code: 0
and for 920:
Enter which talk plan the customer subscribes to:
b
Enter the total number of minutes used during the month
920
The amount due for the month is $251.49 // dont know why this shows
The amount due for the month is $69.99 // should be $ 67.99
Program ended with exit code: 0
please help!. its my first coding class and i have been working on this for the past 5 hours.
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
|
//Your have been asked by a cell phone service provider to write a program that willcalculate the amount of the “talk” portion of a customer’s monthly cell phone bill. Writea C++ program that will calculate the amount of the bill given which talk plan the customer subscribes to and how many voice minutes they used during the month.
#include <fstream>
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{
double A = 39.99;
double B = 59.99;
double C = 69.99;
char talkPlan;
int minutes;
float fee;
cout << "Talk 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 talk plan the customer subscribes to:"<< endl;
cin >> talkPlan;
//determine talk plan
if (talkPlan == 'A' || talkPlan == 'a')
{
cout << "Enter the total number of minutes used during the month" << endl;
}
else if (talkPlan == 'B' || talkPlan == 'b'){
cout << "Enter the total number of minutes used during the month" << endl;
}
else if (talkPlan == 'B' || talkPlan == 'b'){
cout << "Enter the total number of minutes used during the month" << endl;
}
else if (talkPlan == 'C' || talkPlan == 'c'){
cout << "Enter the total number of minutes used during the month" << endl;
}
else {
cout << "Please enter A, B, or C:" << endl; //ends sequence?
}
cin >> minutes;
if (minutes >= 0 && minutes <= 450)
{
cout << "The amount due for the month is $" << fixed << setprecision (2) << A << endl;
}
else if (minutes > 450)
{
fee= 39.99 + ((minutes - 450) *0.45);
cout << "The amount due for the month is $" << fixed << setprecision (2) << fee << endl;
}
else if (minutes >= 451 && minutes <= 900)
{
cout << "The amount due for the month is $" << fixed << setprecision (2) << B << endl;
}
else if (minutes > 900)
{
fee= 39.99 + ((minutes - 900) *0.40);
cout << "The amount due for the month is $" << fixed << setprecision (2) << fee << endl;
}
if (minutes >= 901 && minutes <= 44640)
{
cout << "The amount due for the month is $" << fixed << setprecision (2) << C << endl;
}
return (0);
}
|