Write a program to compute an auto insurance bill. The insurance company computes insurance premiums as a percentage of the value of the vehicle being insured. The following unreasonable rates will be used: See image.
In addition to main, you also will write a separate user-defined function that will use the chart above to determine insurance rates based on age and gender.
The user-defined function will:
The program should first read the driver's age from the user.
If the age is under 14, the program should issue an error message (e.g. "too young to drive"), pause for the user to read the message, and then immediately exit the program with a exit code of 14 (without asking for any more input). NOTE: Same constant may be used for the age limit and the exit code.
Otherwise, if the age is 30 or younger, the program should prompt for and read in the driver's gender. NOTE: The program should work no matter whether the user enters the gender in either upper or lowercase.
Then call the user-defined function to determine which insurance rate to use.
NOTE: If the driver is over 30, the driver's gender will not matter and will not be used by the function. But you will still need to pass in the gender variable (even if it is un- initialized) when calling the function.
After using the function to determine which rate to use, the program should read in the value of the driver's vehicle from the user.
The main function will use the returned rate and vehicle value to compute the insurance cost.
Insurance Premium Calculation Program
Enter driver's age: 23
Enter driver's gender (M/F): M
Enter vehicle value: 15123.81
Finally, the program should neatly display the vehicle value and the annual insurance cost, along with the insurance rate, all lined up correctly, right justified, as described and shown below.
Auto Insurance Bill
Vehicle Value: 15124
Rate Used: 7.4%
Annual Premium: 1119
Write a program to identify a month entered.
First prompt the user for one letter (character) to identify the month.
Then use one large nested switch statement to output one of the following messages:
The program should always produce an output message. Therefore, you need to insure that ALL possible input combinations produce output of either a correct month, or the "Unknown Month" message.
The program should not require the user to enter any more letters than are necessary to determine the output. You are not allowed to use any if statements in this program.
As part of your submission for this week, you must write a test plan for ONE of the two programs (your choice).
Include a list of the test cases you used to test EVERY condition within the program. Your test cases should include what INPUT you used for the test and what OUTPUT you EXPECTED.