Question
(****JAVA****) The HiRisq Insurance company determines auto insurance rates based on a drivers age, number of tickets in the last three years, and the value
(****JAVA****)
The HiRisq Insurance company determines auto insurance rates based on a drivers age, number of tickets in the last three years, and the value of the car. Write a program that asks the user for her age, the number of traffic tickets she has received in the last three years, and the value of her car. Once those three values have been read in, your program will calculate and print the monthly premium that this driver must pay to be insured.
Use the following rules: The base premium is 5 percent of the value of the car. Drivers under 25 years old pay 15 percent more and drivers from 25 through 29 pay 10 percent more. A driver with one ticket pays 10 percent over the premium already figured. Two tickets draws a 25 percent extra charge; three tickets adds 50 percent; and drivers with more than three tickets are refused.
Notes:
To calculate the premium, first apply the base rate of 5% of the value of the car to get the base premium. Then add a percentage of that premium based on the age of the driver. Finally add a percentage of that premium for the number of tickets. For example, for the driver age 19:
Premium = (850 * .05)* 1.15 * 1.50 = 73.3125 ^ ^ ^ car value age tickets
Structure the branches so that you have NO code duplication.
In order to receive full credit:
Have no repeated code in your program.
Do not test for conditions that you know are true.
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