Write a class that extends exception and is called too many


1) Write a class that extends Exception and is called Too Many Occupants Exception. Have the Vehicle class matador for number of occupants throw such an exception if the number Of Occupants would exceed the maximum number of occupants for the vehicle. What will you need to change in your Many Vehicles test class?

2)  Change your Many Vehicles class so that it reads from a text file called Vehicles.txt the specific a- tins for the Vehicles to create. Use a Buffered Reader or a Scanner to read the file. Using a Scanner is probably easier in this case. Here is a sample Vehicles.txt file. The first word in a line is the color, the second word in a line is the make, the third word is the model, and the fourth word is the maximum number of occupants:

red Ford F-150 3 silver BMW 328i 4 blue GM bus 32
gold Chrysler PT Cruiser 4
orange World Industries Pro Board 1#question..

Solution Preview :

Prepared by a verified Expert
Operating System: Write a class that extends exception and is called too many
Reference No:- TGS01187446

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)