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

Exercise 4: Write a program that outputs a dentist bill. For members of a dental

ID: 3633717 • Letter: E

Question

Exercise 4: Write a program that outputs a dentist bill. For members of a dental plan, the bill consists of the service charge (for the particular procedure performed) and test fees, input to the program by the user. To non-members the charges consist of the above services plus medicine (also input by the user). The program first asks if the patient is a member of the dental plan. The program uses methods to calculate the total bill. You may use value returning methods or void methods to get the total charge. Name your program Lab9_Ex4.java. Here is a sample output possible: Sample Run 1: Please input a one if you are a member of the dental plan Input any other number if you are not 1 Please input the service charge 7.89 Please input the test charges 89.56 The total bill is $97.45 Sample Run 2: Please input a one if you are a member of the dental plan Input any other number if you are not 2 Please input the service charge 75.84 Please input the test charges 49.78 Please input the medicine charges 40.22 The total bill is $165.84

Explanation / Answer

please rate - thanks

#include <iostream>
#include <iomanip>
using namespace std;
double getbill(double,double);
double getbill(double,double,double);
int main()
{int member;
double fee,test,meds,total;
cout<<"Please input a one if you are a member of the dental plan ";
cout<<"Input any other number if you are not ";
cin>>member;
cout<<"Please input the service charge ";
cin>>fee;
cout<<"Please input the test charges ";
cin>>test;
if(member==1)
    total=getbill(fee,test);
else
    {cout<<"Please input the medicine charges ";
    cin>>meds;
    total=getbill(fee,test,meds);
    }
cout<<"The total bill is $"<<total<<endl;
system("pause");
return 0;
}
double getbill(double a,double b)
{return a+b;
}
double getbill(double a,double b,double c)
{return a+b+c;
}