Write a program that will calculate car insurance premium using Java!!! Steps to write a program: First things first, your program should ask customer to provide a name, so display a message: "Enter your name". Then ask user about ownership of US driver license. Display message: "Do you have a US driver license?". If user doesn't have a US driver license - display warning message: "Invalid data!" and stop the program (_use System.exit(0) after displaying warning message to stop the program_). Then ask user to provide a zip code. If zip code equals to 20910 or 20740, add $60 to the premium (an amount to be paid for an insurance policy). If zip code equals to 22102 or 22102 , add $30 to the premium. Otherwise add $50 to the premium. Then ask user about car ownership. Display message: "Is this vehicle Owned, Financed, or Leased?". If car is owned, add $10 to the premium, otherwise add $20 to the premium. Then ask user about car usage. Display message: **"How is this vehicle primarily used?".** If car used for **Business**, add **$50** to the premium. If car for Pleasure add **$10** to the premium. If car is for Commute - add **$20** to the premium, and ask user how many days per week user drives to work. Display message: **"Days Driven To Work And/Or School".** Add **$5** to the premium for every day driven to work**.** Then, ask user about how many miles customers drives to work or school. Display message: **"Miles Driven To Work And/Or School".** Increase premium per **$1** for every **1 mile**. Then ask customer about his age. Display message: "How old are you?". If age is less than 16, display message: "Invalid data!", and stop the program. If age is between 16 and 18 (exclusive), multiply premium by 20. If age is between 18 (inclusive) and 21 (inclusive), multiply premium by 6. If age is between 21 (exclusive) and 25 (exclusive), multiply premium by 2. Then, ask customer about driving experience. Make sure that experience is grater than 0 and result of subtraction age from experience is greater or equals to 16. If no, display message: "Invalid data!" and stop the program. Reduce premium on $5 for every year of experience. Then, ask customer about car accidents. Display message: **"Have you had any accidents in the last 5 years?".** If answer equals to **"Yes" or "YES"**, ask customer about amount of accidents. Display message: **"How many?"**, in order to get information about amount of accidents. **Add 20%** to the premium price for every accident. Then, ask customer if he had continuous insurance for the past 12 months. Display message: **"Have you had continuous insurance for the past 12 months?".** If customer provides negative answer (No) - **double the premium**. Then ask user about level of education. Display message: **"What is the highest level of education you have completed?"**. If level of education equals to "PhD" or "Bachelors"or "Masters" - reduce premium by 5%. If the level of education equals to "Doctors" reduce premium by 10%. If level of education equals to "Less than High School" increase premium by 5%. After all, display message "customer, here's your quote!". Instead of customer, you need yo insert customers name. The display message: "Start Your Policy Today For: $premium". Instead of premium, your program should print premium's variable value. Then display message with reference number: "Reference number: referenceNumber". In order to build reference number variable (**referenceNumber**), concatenate first 2 letters of customer's name, age, last 2 letters of of customer's name, zip code, and level of education without spaces. This value should be all upper case!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program that will calculate car insurance premium using Java!!!

Steps to write a program:

First things first, your program should ask customer to provide a name, so display a message: "Enter your name". Then ask user about ownership of US driver license. Display message: "Do you have a US driver license?". If user doesn't have a US driver license - display warning message: "Invalid data!" and stop the program (_use System.exit(0) after displaying warning message to stop the program_).

Then ask user to provide a zip code.

  • If zip code equals to 20910 or 20740, add $60 to the premium (an amount to be paid for an insurance policy).
  • If zip code equals to 22102 or 22102 , add $30 to the premium.
  • Otherwise add $50 to the premium.

Then ask user about car ownership. Display message: "Is this vehicle Owned, Financed, or Leased?". If car is owned, add $10 to the premium, otherwise add $20 to the premium.

Then ask user about car usage. Display message: **"How is this vehicle primarily used?".** If car used for **Business**, add **$50** to the premium. If car for Pleasure add **$10** to the premium. If car is for Commute - add **$20** to the premium, and ask user how many days per week user drives to work. Display message: **"Days Driven To Work And/Or School".** Add **$5** to the premium for every day driven to work**.** Then, ask user about how many miles customers drives to work or school. Display message: **"Miles Driven To Work And/Or School".** Increase premium per **$1** for every **1 mile**.

Then ask customer about his age. Display message: "How old are you?".

  • If age is less than 16, display message: "Invalid data!", and stop the program.
  • If age is between 16 and 18 (exclusive), multiply premium by 20.
  • If age is between 18 (inclusive) and 21 (inclusive), multiply premium by 6.
  • If age is between 21 (exclusive) and 25 (exclusive), multiply premium by 2.

Then, ask customer about driving experience. Make sure that experience is grater than 0 and result of subtraction age from experience is greater or equals to 16. If no, display message: "Invalid data!" and stop the program. Reduce premium on $5 for every year of experience.

Then, ask customer about car accidents. Display message: **"Have you had any accidents in the last 5 years?".** If answer equals to **"Yes" or "YES"**, ask customer about amount of accidents. Display message: **"How many?"**, in order to get information about amount of accidents. **Add 20%** to the premium price for every accident. Then, ask customer if he had continuous insurance for the past 12 months. Display message: **"Have you had continuous insurance for the past 12 months?".** If customer provides negative answer (No) - **double the premium**. Then ask user about level of education. Display message: **"What is the highest level of education you have completed?"**.

  • If level of education equals to "PhD" or "Bachelors"or "Masters" - reduce premium by 5%.
  • If the level of education equals to "Doctors" reduce premium by 10%.
  • If level of education equals to "Less than High School" increase premium by 5%.

    After all, display message "customer, here's your quote!". Instead of customer, you need yo insert customers name. The display message: "Start Your Policy Today For: $premium". Instead of premium, your program should print premium's variable value. Then display message with reference number: "Reference number: referenceNumber". In order to build reference number variable (**referenceNumber**), concatenate first 2 letters of customer's nameagelast 2 letters of of customer's name, zip code, and level of education without spaces. This value should be all upper case!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education