Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Requirement: - build ArrayList class as container. Size: 30 - build Car class to represent a car. - An ArrayList object is to hold objects
Requirement: - build ArrayList class as container. Size: 30 - build Car class to represent a car. - An ArrayList object is to hold objects from Car. ArrayList class should support following functions: - constructor - add (to append the object) - add (add at a specific index) - delete (by index) - search (an object) - traverse (i.e. print the whole list) - size (return the size of the list, not the capacity) Car class should have following fields: - id (int) - make (string) - model (string) - category (string. must be from compact, mid-size, full-size, c-suv, m-suv, f-suv, mini-van, truck) - constructor - accessors and getters. Instructions: - make up 15 cars and store them into the file: cars.data - load these cars' info from the file, initialize 15 Car objects, place them into the Arraylist object - if new cars are added by user, they should be appended to the cars.data file when exiting the program - design a menu based user interface that allows following operations: -- search ---- search by id ---- search by make ---- search by category -- add a new car (new car id cannot be same as existing ones) -- delete an existing car by id -- list all cars -- exit the program - main() should serve mainly as a dispatcher, i.e. it calls other funcitons according user's input.
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