Question
THIS IS NOT WORKING IDK WHY PLEASE HELP AND SHOW A PICTURE import java.util.ArrayList; import java.util.Scanner; public class Automobile { private String make; private String
THIS IS NOT WORKING IDK WHY PLEASE HELP AND SHOW A PICTURE
import java.util.ArrayList; import java.util.Scanner; public class Automobile { private String make; private String model; private String color; private int year; private int mileage; private ArrayList public void Display() { BufferedWriter bw = null; try { // creating File Writer to write text file FileWriter fw = new FileWriter("automobile_output.txt"); // creating Buffered Writer to write text file bw = new BufferedWriter(fw); System.out.println(" Vehicles Information: "); for (int i=0;i public static void main(String[] args) { Automobile automobile = new Automobile(); Scanner userInput = new Scanner(System.in); while(true) { System.out.println(" Select Below option:"); System.out.println("Enter 1 for Add Vehicle"); System.out.println("Enter 2 for Update Vehicle"); System.out.println("Enter 3 for Remove Vehicle"); System.out.println("Enter 4 for Display Vehicles"); System.out.println("Enter 5 for Exit"); System.out.print("Chose option: "); int option = userInput.nextInt(); userInput.nextLine(); if (option == 1) { System.out.println(" Enter Vehicle Information to Add:"); System.out.print("Enter Maker: "); String maker = userInput.nextLine(); System.out.print("Enter Model: "); String model = userInput.nextLine(); System.out.print("Enter Color: "); String color = userInput.nextLine(); System.out.print("Enter Manufacturing Year: "); int year = userInput.nextInt(); userInput.nextLine(); System.out.print("Enter Mileage: "); int mileage = userInput.nextInt(); userInput.nextLine(); Automobile vehicle = new Automobile(maker, model, color, year, mileage); automobile.addVehicle(vehicle); } else if (option == 2) { System.out.println(" Enter Old Vehicle Information to Update:"); System.out.print("Enter Maker: "); String makerOld = userInput.nextLine(); System.out.print("Enter Model: "); String modelOld = userInput.nextLine(); System.out.print("Enter Color: "); String colorOld = userInput.nextLine(); System.out.print("Enter Manufacturing Year: "); int yearOld = userInput.nextInt(); userInput.nextLine(); System.out.print("Enter Mileage: "); int mileageOld = userInput.nextInt(); userInput.nextLine(); System.out.println(" Enter New Vehicle Information to Update:"); System.out.print("Enter Maker: "); String makerNew = userInput.nextLine(); System.out.print("Enter Model: "); String modelNew = userInput.nextLine(); System.out.print("Enter Color: "); String colorNew = userInput.nextLine(); System.out.print("Enter Manufacturing Year: "); int yearNew = userInput.nextInt(); userInput.nextLine(); System.out.print("Enter Mileage: "); int mileageNew = userInput.nextInt(); userInput.nextLine(); automobile.updateVehicle(makerOld, modelOld, colorOld, yearOld, mileageOld, makerNew, modelNew, colorNew, yearNew, mileageNew); } else if (option == 3) { System.out.println(" Enter Vehicle Information to Remove:"); System.out.print("Enter Maker: "); String maker = userInput.nextLine(); System.out.print("Enter Model: "); String model = userInput.nextLine(); System.out.print("Enter Color: "); String color = userInput.nextLine(); System.out.print("Enter Manufacturing Year: "); int year = userInput.nextInt(); userInput.nextLine(); System.out.print("Enter Mileage: "); int mileage = userInput.nextInt(); userInput.nextLine(); automobile.removeVehicle(maker, model, color, year, mileage); } else if (option == 4) { automobile.Display(); } else { System.out.println("Exit!"); break; } } userInput.close(); } }
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