Question
For this next assignment you're to write a program that calculates a dental bill. The first thing your program will have to do is ask
For this next assignment you're to write a program that calculates a dental bill. The first thing your program will have to do is ask if the patient is a member or non-member of a dental plan.
If the patient is a member, you should then prompt the user for an account number. This number will be forwarded to the GetCopayment function, which will examine the account number and to return the correct copayment value. How will GetCopayment determine what to do with the account number? Well, first of all the account number is limited to a six-digit number; so anything other than a six-digit number means an invalid account number has been provided, and in this case GetCopayment should return an invalid value so the caller will know about it (a return value of negative one should work). Otherwise the GetCopayment function will return $15.00 if the account number is between 100000 and 399999, $10.00 if the account number is between 400000 and 699999, and $5.00 if the account number is between 700000 and 999999. If the caller receives an invalid value from GetCopayment, an error message should be displayed indicating that the patient appears to have a problem with their account. Else, the user will then be prompted for the amount for additional services.
The additional services charge and the copayment amount will be passed to the CalcTotal function, which will add the two values together. But before returning the result to the caller, it is first discounted by 8% (after all, this is a member's bill, so they've got to get some benefit, right?).
But what if the user indicates that the patient is not a member of the dental plan? Then the user will be prompted to enter charges for the X-rays, cleaning and any extra; charges. These values will be passed to the CalcTotal function so that their sum will be calculated and returned to the caller, but not before adding a 12% surcharge!
In case you haven't noticed yet, this program will contain two functions called CalcTotal. But there's no problem with that because you'll be overloading the functions (see p.232 in your textbook for more information). To get a better feel for the program, take a peek at DentalPlanSampleRuns.txt for some insight on program behavior. You can leave your code in a file called dentalplan.cpp in the HW07 subdirectory you'll create. Have fun, and don't forget to floss!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started