On this page:
Instructions
1 Abstracting Over Data Definitions
8.13

Assignment 4: Abstracting Over Vehicles🔗

Goals: Learn to design abstract classes and class hierarchies.

Instructions🔗

This is a standalone variant of Assignment 4.

Be very, very careful with naming. The solution files expect your submissions to use the class, interface, field, method, constructor, argument, and file names specified here.

The submission will be organized as follows:

1 Abstracting Over Data Definitions🔗

Related files:
  Vehicle.java  

A mode of transportation uses a particular type of infrastructure or vehicle. Modes include air, ground, and water, while vehicles include airplanes, trains, and buses. In this problem, we will work with different vehicles.

Each vehicle has a name, passenger capacity, per passenger fare, and fuel capacity. Different kinds of vehicles can also contain additional information as shown in the supplied Vehicle.java file.

Note: only the totalRevenue() method is properly implemented. The others are stubs that currently return dummy values, so the code will compile but not yet work.

Warmup: Download the file and work out the following problems:

Once you have finished these methods and are confident that they work properly, save the work you have done to a separate file. Do not submit the code as written so far. The problems below are the main point of this exercise, and it will be helpful for you to preserve the code written so far as a reference against which to compare your revised code below. Again, submit only the work below.