Hi everyone!
I must write a code however i have no idea how to do this.
First screen How it should be.
Second is my code.
Could you tell me please smth
Actually i do not understand what im doing and just have a write code from lecture slides.
P.s NUMBER_OF_CARS” should be equal to the highest digit in your student ID. My is 6
import java.util.Scanner; public class ReadingRegistrarion { public static void main( String args[] ) { Scanner input = new Scanner( System.in); int number1; int number2; int number3; int number4; int number5; int number6; System.out.print( "Enter the registration car number 1" ); number1 = input.nextInt(); System.out.print( "Enter the registration car number 2" ); number2 = input.nextInt(); System.out.print( "Enter the registration car number 3" ); number3 = input.nextInt(); System.out.print( "Enter the registration car number 4" ); number4 = input.nextInt(); System.out.print( "Enter the registration car number 5" ); number5 = input.nextInt(); System.out.print( "Enter the registration car number 6" ); number6 = input.nextInt(); System.out.printf public class CarInsurance { public void processCars() { } private double calculateFee(int inputAge) { } private double calculateDiscount(double originalFee, boolean accident) { } private boolean requestAccidentHistory() { } private void finalOutput() { } public static void main(String[] args) { CarInsurance carInsurance = new CarInsurance(); carInsurance.processCars(); } }
You work for the local car insurance company, Motorcity. Your boss decided that the company is ready to expand and wants a small program to help the local offices calculate insurance quotes for a high volume of cars.
You are asked to write a Java Console Application (CarInsurance class) which will accept details for a fixed number of cars. The number of cars should be represented by a constant “NUMBER_OF_CARS” in your program.
“NUMBER_OF_CARS” should be equal to the highest digit in your student ID, use NUMBER_OF_CARS=3 if your highest digit is less than 3. For example, if your student ID is S0343126, NUMBER_OF_CARS should be equal to 6.
The details for each car to be input are their
1. car registration (license plate) number,
2. age
3. and whether the car had been in an accident before
If a car had never been in an accident before, a 25% discount off its insurance cost should be applied.
The pricing structure for Motorcity’s car insurance is as follows:
• Cars over 5 years old will cost $350.00.
• Cars less than and up till 5 years old will cost $200.00.
A meeting with your boss produced the following draft of how the program should run:
For “NUMBER_OF_CARS” number of cars:
1. Enter the car registration number
2. Enter the age of the car
3. Enter “y”, “Y”, “n” or “N” for car accident history. (Assume no other input is possible)
4. The application will calculate and display the discount (if applicable) and the total cost of the insurance less the discount, and then display these details to the user on the screen.
For example, the following output would be ideal:
5. If there is no discount then just the final insurance fee will be displayed
Finally when all the cars have been entered, a summary should be displayed.
The following should be included in the summary:
a) the number of cars entered
b) the total discounts given
c) the total insurance paid
d) and the average insurance paid
(see sample output below).
Also display a closing message which includes your student ID (see sample output below).
Numeric results should be displayed with suitable precision, for example use two decimal places for currency and percentage amounts.