/*
Sean Hodgins
Assign 2-2
Visual C++ 2005 Express Edition
Purpose: To write a program that calculates a hospital bill from user entered information.
Variables: days,surgery,medication,misc,costperday,insurance,total,dedcut,dedmed- all user entered variables.
input-requests the user to input.
display-outputs the totals after they have been calculated
total,deduct,dedmed-function that do the calculations.
startup-displays what the program will do.
*/
#include "stdafx.h"
#include
using namespace std;
float input();
float totalfunc(float,float,float,float,float);
float deductfunc(float,float);
float dedmedfunc(float,float);
void display(float,float,float);
void startup();
int main()
{
float days;
float surgery;
float medication;
float misc;
float costperday;
float insurance;
float total;
float deduct;
float dedmed;
startup();
cout<<"Please enter the number of days stayed:\n";
days = input();
cout<<"Please enter the cost of surgery:\n";
surgery = input();
cout<<"Please enter the cost of Medication:\n";
medication = input();
cout<<"Please enter the cost of Miscellaneous:\n";
misc = input();
cout<<"Please enter the cost per day stayed:\n";
costperday = input();
cout<<"Please enter your insurance deductible:\n";
insurance = input();
total = totalfunc(days, surgery, medication, misc, costperday);
deduct = deductfunc(total, insurance);
dedmed = dedmedfunc(deduct, medication);
display(total,deduct,dedmed);
cin.get();
cin.get();
return 0;
}
float totalfunc(float days, float surgery,float medication,float misc,float costperday)
{
float x;
x = (days*costperday)+medication+misc+surgery;
return(x);
}
float deductfunc(float total, float insurance)
{
float y;
y = total - insurance;
return(y);
}
float dedmedfunc(float deduct, float medication)
{
float z;
z = deduct - medication;
return(z);
}
void startup()
{
cout<<"This program will calculate your Hospital Bill.\n";
cout<<"Press to continue\n";
cin.get();
}
void display(float total, float deduct,float dedmed)
{
cout<<"Your Total is: "<< total << "$\n";
cout<<"Your Total minus your Deductable is: "<>x;
return(x);
}
/*
This program will calculate your Hospital Bill.
Press to continue
Please enter the number of days stayed:
45
Please enter the cost of surgery:
25
Please enter the cost of Medication:
65
Please enter the cost of Miscellaneous:
45
Please enter the cost per day stayed:
75
Please enter your insurance deductible:
85
Your Total is: 3510$
Your Total minus your Deductable is: 3425$
Your Total minus your Deductable and Medication is: 3360$
*/