Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I've done the vehicle.java, car.java, truck.java, suv.java, timespan.java, exceptions and reservation.java but thats about it so far Problem Description You are to develop and test

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
I've done the vehicle.java, car.java, truck.java, suv.java, timespan.java, exceptions and reservation.java but thats about it so far
Problem Description You are to develop and test the Java classes needed to maintain a collection of vehicles of various type. Vehicles should be able to be added to the collection; reservations should be able to be made, displayed, and cancelled; and the vehicles should be able to be listed (either all vehicles, or only those that are not reserved). Problem Scenario Vehicles are identified by a unique VIN (Vehicle Identification Number). The set of features maintained for cars, SUVs and trucks are different. Cars are specified as a specific make/model/year, a miles per gallon rating, and seating capacity. SUVs are specified as a particular make/model/year, a miles per gallon rating, seating capacity, and cargo capacity. Trucks are specified as a particular length (in feet), a miles per gallon rating, and load capacity. The list of vehicles that you MUST USE, including the vehicle identification numbers (VINS) provided for this assignment is given below. (NOTE: Your output is NOT expected to be lined up as shown below. See middle of page 4 below.) Make/Model Mileage VIN Seating Capacity CARS Chevrolet Camaro - 2018 Ford Fusion - 2018 Ford Fusion Hybrid - 2017 Chevrolet Impala - 2019 30 mpg 34 mpg 32 mpg 30 mpg 4 HK4GM4564GO AB4EG5689GM KV4EG3245RW RK38M4366YH Make/Model Mileage Seating Cargo Capacity Capacity VIN SUVs Honda Odyssey - 2020 Dodge Caravan - 2019 Ford Expedition - 2018 28 mpg 25 mpg 20 mpg 7 5 5 6 cubic ft. 4 cubic ft. 3 cubic ft VN9RE2635TD OK3FT4273ME JK2RT8284HY Make/Model Mileage Load Capacity VIN Trucks Ten-Foot Eighteen-Foot Twenty-Four Foot Twenty Four Foot 12 mpg 10 mpg 8 mpg 8 mpg 2810 lbs 5930 lbs 6500 lbs 6500 lbs EJSKU2437BC KG4DM5472RK EB2WR30820B TV3GH4380EK Classes Needed Abstract Vehicle Class Instance variables private String description // atores make-model-year for cars and SUVs, stores length for trucks private int mpg Il miles per gallon rating private String vin I/ unique vehicle identification number private Reservation resy Il reservation Information (a null value means not reserved) constructor Inits with provided description (car/SUVs: make-model-year, Trucks length), mpg and VIN. Sets resv to null(le, newly created vehicles are not yet reserved). methods public int getMp90 {-) public String gelVINO (-) public Reservation getReservation() { public abstract String toString(): ABSTRACT METHOD - must be implemented in each subclass public boolean in Reserved() { public void reserve(Reservation 1) (-) puble cancelReservation) ... ) throws Unreserved VehicleException if reservation doesn't exist Car, SUV and Truck Classes Subclasses of the abstract Vehicle class. Each contains an appropriate constructor, added instar variables, and appropriate implementation of the toString method. Reservation Class Instance variables private String credit CardNum, Il credit card number vehicle reserved under private TimeSpan rentalPeriod; lleg, four days, two weeks one month private boolean insurance Selected I/ set to true if optional daily insurance wanted methods appropriate constructor, getter methods and toString method. Note that reservations cannot be altered once created fie, Reservation objects are immutable) TimeSpan Class instance variables private char timeUnit: IT'D' (day). W (week), M (month) private int numUnits: Ifnum of days, weeks or months constructor lgers 1 appropriate constructor and getters instance Vehicles Class (collection of Vehicle objects) instance able private Vehicle | agency vehicles Il array of Vehicle objects (ArrayList type may NOT be used) private int current used by iterator methods only methods appropriate constructor) public void add(Vehicle v adds a new vehicle to the collection public Vehicle getVehicle(String VIN) Il tows VINNotFoundException if no veide found for provided VIN Herator methods blic void reset Wresets to first vehicle inst public boolean hasNex) I returns true if more vehicles in list to releve public Vehicle getNext Irums next vehicle in 2 Vehicles Vehicle Reservation Car SUV Truck UML Class Diagram 9 Aggregation collection) Composition Subclass The following summarizes the requirements for this stage of the program: 1. Initially populate the collection of vehicles with the information on page 1. (USEFUL HINT: Use your own simple VINs for your testing, and add the actual VINs before submitting) 2. Can add new vehides to the collection. 3. Can reserve a vehicle, display a reservation, and cancel a reservation. 4. Can display the list of all vehicles, eg. ALL AGENCY VEHICLES Ford Fusion - 2018 (Car) MPG:34 Seating 4 VINE AB4EG5689GM Dodge Caravan - 2019 (SUV) MPG: 25 Seating: 5 Storage: 4 cu.ft. VIN: OK3FT4273ME Eighteen-Foot (Truck) MPG 10 Load Capacity: 5930 lbs. VIN: KG4DM5472RK etc. 5. Can display a list of unreserved vehicles only. AVAILABLE VEHICLES Dodge Caravan - 2019 (SUV) MPG: 25 Seating 5 Storage: 4 cu. ft. VIN: OK3FT4273ME Eighteen-Foot (Truck) MPG: 10 Load Capacity: 5930 lbs. VIN: KG4DM5472RK etc. Main Class The main class of the program (with main method) will behave as a test driver for the classes developed The program must provide the following menu of options EXACTLY as given 1. Display all vehicles 2 - Display available vehicles 3. Reserve a vehicle 4. Display a Reservation 5. Cancel a Reservation 6 - Add a vehicle 7. Quit Submission Requirements (1) Submit the java source files only as a single zip file (2) Follow the general submission requirements documented on Blackboard in the Programs folder Problem Description You are to develop and test the Java classes needed to maintain a collection of vehicles of various type. Vehicles should be able to be added to the collection; reservations should be able to be made, displayed, and cancelled; and the vehicles should be able to be listed (either all vehicles, or only those that are not reserved). Problem Scenario Vehicles are identified by a unique VIN (Vehicle Identification Number). The set of features maintained for cars, SUVs and trucks are different. Cars are specified as a specific make/model/year, a miles per gallon rating, and seating capacity. SUVs are specified as a particular make/model/year, a miles per gallon rating, seating capacity, and cargo capacity. Trucks are specified as a particular length (in feet), a miles per gallon rating, and load capacity. The list of vehicles that you MUST USE, including the vehicle identification numbers (VINS) provided for this assignment is given below. (NOTE: Your output is NOT expected to be lined up as shown below. See middle of page 4 below.) Make/Model Mileage VIN Seating Capacity CARS Chevrolet Camaro - 2018 Ford Fusion - 2018 Ford Fusion Hybrid - 2017 Chevrolet Impala - 2019 30 mpg 34 mpg 32 mpg 30 mpg 4 HK4GM4564GO AB4EG5689GM KV4EG3245RW RK38M4366YH Make/Model Mileage Seating Cargo Capacity Capacity VIN SUVs Honda Odyssey - 2020 Dodge Caravan - 2019 Ford Expedition - 2018 28 mpg 25 mpg 20 mpg 7 5 5 6 cubic ft. 4 cubic ft. 3 cubic ft VN9RE2635TD OK3FT4273ME JK2RT8284HY Make/Model Mileage Load Capacity VIN Trucks Ten-Foot Eighteen-Foot Twenty-Four Foot Twenty Four Foot 12 mpg 10 mpg 8 mpg 8 mpg 2810 lbs 5930 lbs 6500 lbs 6500 lbs EJSKU2437BC KG4DM5472RK EB2WR30820B TV3GH4380EK Classes Needed Abstract Vehicle Class Instance variables private String description // atores make-model-year for cars and SUVs, stores length for trucks private int mpg Il miles per gallon rating private String vin I/ unique vehicle identification number private Reservation resy Il reservation Information (a null value means not reserved) constructor Inits with provided description (car/SUVs: make-model-year, Trucks length), mpg and VIN. Sets resv to null(le, newly created vehicles are not yet reserved). methods public int getMp90 {-) public String gelVINO (-) public Reservation getReservation() { public abstract String toString(): ABSTRACT METHOD - must be implemented in each subclass public boolean in Reserved() { public void reserve(Reservation 1) (-) puble cancelReservation) ... ) throws Unreserved VehicleException if reservation doesn't exist Car, SUV and Truck Classes Subclasses of the abstract Vehicle class. Each contains an appropriate constructor, added instar variables, and appropriate implementation of the toString method. Reservation Class Instance variables private String credit CardNum, Il credit card number vehicle reserved under private TimeSpan rentalPeriod; lleg, four days, two weeks one month private boolean insurance Selected I/ set to true if optional daily insurance wanted methods appropriate constructor, getter methods and toString method. Note that reservations cannot be altered once created fie, Reservation objects are immutable) TimeSpan Class instance variables private char timeUnit: IT'D' (day). W (week), M (month) private int numUnits: Ifnum of days, weeks or months constructor lgers 1 appropriate constructor and getters instance Vehicles Class (collection of Vehicle objects) instance able private Vehicle | agency vehicles Il array of Vehicle objects (ArrayList type may NOT be used) private int current used by iterator methods only methods appropriate constructor) public void add(Vehicle v adds a new vehicle to the collection public Vehicle getVehicle(String VIN) Il tows VINNotFoundException if no veide found for provided VIN Herator methods blic void reset Wresets to first vehicle inst public boolean hasNex) I returns true if more vehicles in list to releve public Vehicle getNext Irums next vehicle in 2 Vehicles Vehicle Reservation Car SUV Truck UML Class Diagram 9 Aggregation collection) Composition Subclass The following summarizes the requirements for this stage of the program: 1. Initially populate the collection of vehicles with the information on page 1. (USEFUL HINT: Use your own simple VINs for your testing, and add the actual VINs before submitting) 2. Can add new vehides to the collection. 3. Can reserve a vehicle, display a reservation, and cancel a reservation. 4. Can display the list of all vehicles, eg. ALL AGENCY VEHICLES Ford Fusion - 2018 (Car) MPG:34 Seating 4 VINE AB4EG5689GM Dodge Caravan - 2019 (SUV) MPG: 25 Seating: 5 Storage: 4 cu.ft. VIN: OK3FT4273ME Eighteen-Foot (Truck) MPG 10 Load Capacity: 5930 lbs. VIN: KG4DM5472RK etc. 5. Can display a list of unreserved vehicles only. AVAILABLE VEHICLES Dodge Caravan - 2019 (SUV) MPG: 25 Seating 5 Storage: 4 cu. ft. VIN: OK3FT4273ME Eighteen-Foot (Truck) MPG: 10 Load Capacity: 5930 lbs. VIN: KG4DM5472RK etc. Main Class The main class of the program (with main method) will behave as a test driver for the classes developed The program must provide the following menu of options EXACTLY as given 1. Display all vehicles 2 - Display available vehicles 3. Reserve a vehicle 4. Display a Reservation 5. Cancel a Reservation 6 - Add a vehicle 7. Quit Submission Requirements (1) Submit the java source files only as a single zip file (2) Follow the general submission requirements documented on Blackboard in the Programs folder

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago