Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I tried to work on the problem, but getting error for the variablesto be used wi

ID: 3616480 • Letter: I

Question

I tried to work on the problem, but getting error for the variablesto be used without reference, can someone please help me to (edit)the code so it works. Thanks in advance.

Question) Develop a C++ program that will compute the total bill ofa hospital patient. The user
inputs are: number of days in hospital, surgery cost, medicationcost, miscellaneous cost,
cost per day and insurance deductible. The program must compute thefollowing for
insurance purposes: total cost, total cost less insurancedeductible, total cost less cost of
medication and deductible. Use four separate functions:
a. to inform the user about the purpose of the program
b. to input data (hint: at the end of the data input call thecalculations function
instead of returning the input values to “main”)
c. to perform the calculations (same identifiers for actual andformal parameters)
d. to print the results (different identifiers for actual andformal parameters)

My Code

#include "stdafx.h"
#include <iostream>

using namespace std;

void input(double,double,double,double,double,double);
void output (double,double,double);
void print();


int _tmain(int argc, _TCHAR* argv[])
{
    double days_stay;
    double surgery_cost,medication_cost,miscellaneous_cost,cost_perday,insurance_deductable;

    input (days_stay,surgery_cost,medication_cost,miscellaneous_cost,cost_perday,insurance_deductable);
    cin.get();
//    return 0;
}
void input (double days_stay,double surgery_cost, doublemedication_cost,double miscellaneous_cost,double cost_perday,doubleinsurance_deductable)
{
    cout<<" Please enter number of days inhospital ==> ";
    cin>>days_stay;
    cout<<" Surgery cost ==> ";
    cin>>surgery_cost;                 
    cout<<" Mdication cost ==> ";
    cin>>medication_cost;
    cout<<"Miscellaneous Cost ==> ";
    cin>>miscellaneous_cost;
    cout<<"cost per day ==>";
    cin>>cost_perday;
    cout<<"Insurance deductable";
    cin>>insurance_deductable;

    double total, total_insurance,total_medCost;
    output (total ,total_insurance,total_medCost);

}
void output (double total, double total_insurance, doubletotal_medCost)
{
    double days_stay;
    double surgery_cost,medication_cost,miscellaneous_cost,cost_perday,insurance_deductable;

    input (days_stay,surgery_cost,medication_cost,miscellaneous_cost,cost_perday,insurance_deductable);

    total =(days_stay*cost_perday)+surgery_cost+medication_cost+miscellaneous_cost;
    total_insurance = total -insurance_deductable;
    total_medCost = total -surgery_cost-medication_cost-insurance_deductable;

    print();

}

void print ()
{
    double total, total_insurance,total_medCost;
    output(total,total_insurance,total_medCost);
    cout<<"Total cost ==>"<<total<<endl;
    cout<<"Total_insurance covered ==>"<<total_insurance<<endl;
    cout<<"Total Medical cost ==>"<<total_medCost<<endl;
}


Explanation / Answer

please rate - thanks hope this helps I changed it so it would run on Dev C++ #include using namespace std; void input(); void calculate(double,double,double,double,double,double); void print(double,double,double); int main() {        input (); system("pause"); return 0; } void input () {   double days_stay;     double surgery_cost,medication_cost,miscellaneous_cost,cost_perday,insurance_deductable;     cout>days_stay;     cout>surgery_cost;                       cout>medication_cost;     cout>miscellaneous_cost;     cout>cost_perday;     cout>insurance_deductable;     calculate (days_stay ,surgery_cost,medication_cost,miscellaneous_cost,cost_perday,insurance_deductable); } void calculate(double days_stay, double surgery_cost, doublemedication_cost,double miscellaneous_cost,    double cost_perday, double insurance_deductable ) {double total, total_insurance, total_medCost;         total =(days_stay*cost_perday)+surgery_cost+medication_cost+miscellaneous_cost;     total_insurance = total -insurance_deductable;     total_medCost = total -surgery_cost-medication_cost-insurance_deductable;     print(total, total_insurance,total_medCost); } void print (double tot, double insurance, double medCost) {        cout