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
|
#include <iostream>
#include <string>
using namespace std;
void Input(string [], int*, int*);
void Process(int*, int*);
void Output(int, int, double, double, double);
void Input(string cellNumber[], int *numOfRelays, int *minutes)
{
cout<<"Enter your Cell Phone Number: ";
cin>>*cellNumber;
cout<<"Enter the number of relay stations: ";
cin>>*numOfRelays;
cout<<"Enter the length of the call in minutes: ";
cin>>*minutes;
Process(numOfRelays, minutes);
}
void Process(int relays, int mins)
{
double tax;
if (1<=relays<=5)
tax = .01;
else if (6<=relays<=11)
tax = .03;
else if (12<=relays<=20)
tax = .05;
else if (21<=relays<=50)
tax = .08;
else if (relays>50)
tax = .12;
double netCost = ((0.40*relays)/50*mins);
double taxOnCall = netCost * (tax/100);
double totalCostOfCall = netCost + tax;
Output(relays, mins, netCost, taxOnCall, totalCostOfCall);
}
void Output(string cellNumber, int numOfRelays, int minutes, double netCost, double taxOnCall, double totalCostOfCall)
{
cout<<"Cell Phone Number: "<<cellNumber.substr(0,3) + "-" + cellNumber.substr(3,3) + "-" + cellNumber.substr(6,4) + "\n"<<endl;
cout<<"Number of Relay Stations: "<<numOfRelays<<"\n"<<endl;
cout<<"Length of Call in Minutes: "<<minutes<<"\n"<<endl;
cout<<"Net Cost of Call: "<<netCost<<"\n"<<endl;
cout<<"Tax of Call: "<<taxOnCall<<"\n"<<endl;
cout<<"Total Cost of Call: "<<totalCostOfCall<<"\n"<<endl;
}
int main()
{
string cellNumber[11];
int numOfRelays;
int minutes;
Input(cellNumber, &numOfRelays, &minutes);
return 0;
}
|