# include "stdafx.h"
# include <iostream>
using namespace std;
void Input(double cell_num, double relays, int & call_length);
void Output(double cell_num, double relays, double call_length, double net_cost, double call_tax, double total_cost);
void Process(double relays, double call_length, double net_cost, double call_tax, double total_cost);
void Input(double cell_num, double relays, double call_length)
{
cout << "Enter your seven digit cell phone number.\n";
cin >> cell_num;
cout << "Enter the number of relay stations.\n";
cin >> relays;
cout << "Enter the number of minutes used to the nearest minute.\n";
cin >> call_length;
}
void Output(double cell_num, double relays, double call_length, double net_cost, double call_tax, double tax_rate, double total_cost)
{
if ((relays >= 1) && (relays <= 5))
tax_rate = .01;
else if ((relays >= 6) && (relays <= 11))
tax_rate = .03;
else if ((relays >= 12) && (relays <= 20))
tax_rate = .05;
else if ((relays > 21) && (relays <= 50))
tax_rate = .08;
else if (relays > 50)
tax_rate = .12; // lines 39-48 used to assign taxation.
net_cost = (relays / 50 * .4 * call_length);
call_tax = net_cost * tax_rate;
total_cost = net_cost + call_tax;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
}
void Process(double cell_num, double relays, double call_length, double net_cost, double call_tax, double total_cost)
{
cout << "Callers Info Calculated output\n";
cout << "============================================\n";
cout << "Cell phone: " << cell_num;
cout << "\nRelay Stations: " << relays;
cout << "\nMinutes Used: " << call_length;
cout << "\nNet Cost: " << net_cost;
cout << "\nCall Tax: " << call_tax;
cout << "\nTotal cost: " << total_cost;
}
int main()
{
double cell_num=0;
double relays = 0;
double call_length = 0;
double net_cost = 0;
double call_tax = 0;
double tax_rate = 0;
double total_cost = 0;
Input(cell_num, relays, call_length);
Process(relays, call_length, net_cost, call_tax, total_cost);
Output(cell_num, relays, call_length, net_cost, call_tax, total_cost);
return 0;
}
Pretty new to functions in general and not understanding the errors I am getting. I had a working program but i tried to organize it into functions and i cant get it to work properly. if someone could help me and explain why certain changes are needed so i can fix in future i would greatly appreciate it.