### Program #1

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.

NOTES:

• All of the fixed values in the above table should be stored as constants, using descriptive constant names. This means that you will need to create constants for the age limits of each bracket, as well as for the rates.
• The company should be able to modify any of the ages or rates in the table, simply by changing the constant values, and without having to modify any of the executable code.
• Do not embed any constant values in the constant names!
• Example: const double RATE_OVER_75 = 0.075; // incorrect
• This constant is defined incorrectly, because age 75 is embedded in the constant name. const int RATE6_TOP_AGE = 75; const double RATE6 = 0.062; const double RATE7 = 0.075; // better!

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:

• Be given a descriptive name that describes what the function does
• Take the age and gender as input arguments and will return an insurance rate to use for premium calculations in the main function.
• Use BOTH nested if statement(s) AND extended multi-way selection if statement(s) to determine the correct insurance rate for the driver.

### Program Implementation

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.

### Input Example

Insurance Premium Calculation Program
Enter driver's age: 23
Enter driver's gender (M/F): M
Enter vehicle value: 15123.81

NOTES:

• You do not have to error check any of the user input -- you may assume all valid answers will be entered. But you must accept upper or lowercase for the gender.
• If the driver is over 30, the program should NOT prompt for a gender.

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.

• Use output format manipulators to round the vehicle value and annual insurance premium to the nearest WHOLE dollar.
• Also use output format manipulators to round the insurance rate to one decimal place.

### Output Example

Auto Insurance Bill
Vehicle Value: 15124
Rate Used: 7.4%
Annual Premium: 1119

### Program #2

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:

• If the letter is 'F' or 'f', output: The month is February
• If the letter is 'S' or 's', output: The month is September.
• If the letter is 'O' or 'o', output: The month is October.
• If the letter is 'N' or 'n', output: The month is November.
• If the letter is 'D' or 'd', output: The month is December.
• If the letter is ‘A’ or ‘a’, prompt for the second letter:
• If the second letter is ‘P’ or ‘p’, output: The month is April.
• If the second letter is ‘U’ or ‘u’, output: The month is August.
• If the letter is 'J' or 'j', prompt for the user for a second letter.
• If the second letter is ‘A’ or ‘a’, output: The month is January
• If the second letter is ‘U’ or ‘u’, prompt for the third letter: If the third letter is ‘L’ or ‘l’, then output July If the third letter is ‘N’, or ‘n’, then output June
• If the letter is ‘M’ or ‘m’, prompt for the next two letters at once (note that you can still read them into two separate character variables). Be sure to verify the correctness of BOTH the second and third letters (not just the third letter!)
• If the third letter is ‘R’ or ‘r’, output: The month is March
• If the third letter is ‘Y’ or ‘y’, output: The month is May
• If none of the above situations apply, output: Unknown Month.

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.

NOTES:

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.

### Testing

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.

### Sample Plan Formats

See image.
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.