Plan the logic for an insurance company program to


Problem

a. Plan the logic for an insurance company program to determine policy premiums. The program continuously prompts the user for an insurance policy number. When the user enters an appropriate sentinel value, end the program. Call a method that prompts each user for the type of policy needed-health or auto. While the user's response does not indicate health or auto, continue to prompt the user. When the value is valid, return it from the method. Pass the user's response to a new method where the premium is set and returned-$250 for a health policy or $175 for an auto policy. Display the results for each policy.

b. Modify Exercise 9a so that the premium-setting method calls one of two additional methods-one that determines the health premium or one that determines the auto premium. The health insurance method asks users whether they smoke; the premium is $250 for smokers and $190 for nonsmokers. The auto insurance method asks users to enter the number of traffic tickets they have received in the last three years. The premium is $175 for drivers with three or more tickets, $140 for those with one or two tickets, and $95 for those with no tickets. Each of these two methods returns the premium amount to the calling method, which returns the amount to be displayed.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Plan the logic for an insurance company program to
Reference No:- TGS02648646

Expected delivery within 24 Hours