Design classes that reflect vehicle, car, american car, foreign car, truck, and bicycle with ALL appropriate inheritances.
vehicle is the parent.
Your code must override the toString method in each class to display ALL the relevant information from the record.
Also design an application with a main that tests your classes and processes a file of records (main is specified later).
The file of data to be used from the menu system has the following format:
vehicle (fixed)
owner's name (string)
address (string)
phone (string)
email (string)
car (fixed)
true or false for convertible (boolean)
color (string)
american car (fixed)
true or false for made in Detroit (boolean)
true or false for union shop (boolean)
foreign car (fixed)
country of manufacturer (string)
import duty (float)
bicycle (fixed)
# of speeds (int)
truck (fixed)
# of tons (float)
cost of truck (float)
date purchased (format below in exmample)
etc.....these records can appear in any order and there can be any number of them.
Each record will have a line that identifies its type and then on separate lines will be the data.
Records will have a blank line between them.
You will need to use an array of Vechiles to store the data.
Here are some examples of data:
foreign car
aMarioy
Mario's house
(777) 777-7777
[email protected]
false
black
Italy
4415.91
truck
aDougy
Doug's house
(123) 456-7890
30
61234.56
8/10/2003
vehicle
aRobby
Rob's house
(987) 654-3210
bicycle
bTommy
Tom's house
(246) 810-1214
7
bGeorge
George's house
(666) 666-6666
25
51234.56
12/4/2004
bTim
Tim's house
(111) 111-1111
bJim
Jim's house
(555) 555-5555
5
american car
bJohn
John's house
(888) 888-8888
true
green
car
cKen
Ken's house
(999) 999-9999
orange
cMario
zDoug
eRob
fTom
gSam
Sam's house
(333) 333-3333
blue
Write an application with a main that reads a file (from the command line) and fills an array of type vehicle[] with new vehicle
(params), new car (params), new american car (params) new foreign car(params) , new truck (params),
new bicycle (params), etc. depending on the first line that identifies each record.
Then it has a menu system that has the following features (THE MENU ITEMS SHOULD BE ABLE TO BE CHOSEN IN ANY ORDER
AND CONTINUOUSLY UNTIL THE USER ENTERS THE WORD STOP):
1. Calls a printAll method that can be passed an array of type vehicle[] and which prints each element of
the array using the appropriate toString() methods. ArrayList is fine if you wish to use it.
2. Calls a sort method that can be passed an array of type vehicle[] and which sorts the array by email addresses
and prints the new sorted array using appropriate toString() methods. Any sort method is fine, but it should
sort according to unicode (case sensitive, that is to say that all upper case is before any lower case)!
3. Calls a method that prints the number of records.
4. Calls a method that prints just the bicycles and trucks (from the sorted array using the appropriate toString() methods).
5. Calls a method that prints the vehicles in area code 987.
Be sure to declare variables as private, to extend all the classes appropriately, and to have the right constructors (using super where
appropriate), and the getters and setters for ALL the variables. MUST SEND ALL THE OUTPUT FROM PRINTING TO THE CONSOLE, NOT TO A WINDOW.
MUST TAKE ALL THE OPTIONS FOR THE MENU FROM THE CONSOLE.