IC211 Spring AY 2020

HW Commonality via Inheritance

Name (Last, First): ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________

  1. [100pts] We're providing you a program (HW11.java and Vehicle.java) that reads in a file of vehicles (vehicles.txt) and then prints a summary of them. An example of one line in the text follow:
    truck f150 18

    Each line contains 3 parts: the type of vehicle, the model, and its average mpg.

    Your job is to modify this program to use proper OOP Design (not just inheritance, everything). The output of the program should not change. Currently the program outputs each vehicle in a fun readable format:

    f150 bumbumbum does not fly with 4 wheels.
    maxima vroom does not fly with 4 wheels.
    corvette vroom does not fly with 4 wheels.
    747 woooosh does fly with 3 wheels.
    civic vroom does not fly with 4 wheels.
    g550 woooosh does fly with 3 wheels.
    silverado bumbumbum does not fly with 4 wheels.
    yamaha errrrrrm does not fly with 2 wheels.
    scion vroom does not fly with 4 wheels.
    tahoe bumbumbum does not fly with 4 wheels.

    Your only job is to change the program to use proper OOP design.

    Turn In: This sheet, of course, and a printout (using codeprint please!) of HW11.java, Vehicle.java, and ANY NEW .JAVA files you created, along with a screencapture showing your program's output being the same as above.