(****JAVA****) Please use basic if/else statements and the use of the equation p
ID: 3719855 • Letter: #
Question
(****JAVA****)
Please use basic if/else statements and the use of the equation provided in the bottom. Thank you.
The HiRisq Insurance company determines auto insurance rates based on a driver’s 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:
• 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.
Explanation / Answer
Please find my implementation.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.