Introduction to Computing Science
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Coding Assignment 2 - CISC 124 - Introduction to Computing Science
DESCRIPTION
Overview - Order of Submission
The following assignment has a peer review component. Here is the order of submission:
1. Read the activity description and prepare the relevant le.
2. Submit your le
in Aropa and start the peer review process (instructions to follow).
3. Review and revise your work (optional).
4. Submit your nal
work in OnQ.
Description
Department of Transportation Registry
In this assignment, you will have the opportunity to practice writing several Java classes involving
inheritance. You have been hired by the Department of Transportation to create a program that they
can use to keep track of vehicle registrations. Your program will maintain registration details for cars,
trucks and motorcycles. The hierarchy of the program will be structured as follows:
You will write a Vehicle class that will be used to represent all types of vehicles. You will then write
three sub-classes: Car, Truck, and Motorcycle. These sub-classes will contain the variables and
methods that are specic
to particular types of Vehicles.
You will write a CarOwner class which will represent the owner of a vehicle.
You will write a Registry class. This class is a simple collection class that represents a collection of
vehicle objects.
The Vehicle class will have the following instance variables:
- registrationNumber (vehicle's registration number)
- owner (a CarOwner object representing the owner of the vehicle)
- odometerReading (representing the odometer reading of the vehicle)
- make (make of the vehicle -- i.e. Chevrolet)
- model (model of the vehicle -- i.e. Silverado)
- year (model year of the vehicle. The model year of the vehicle must be 1980 or later)
- numWheels (number of wheels on the vehicle. Every vehicle has a minimum of 2 wheels)
- plateNumber (the license plate number. This will be a combination of letters (L) and numbers (#). In
Ontario, a license plate is of the form 4L's and 3#'s. As an example, a license plate may be: HGKW
815. Every vehicle's plate number must be of the correct letter-number combination).
In addition to the instance variables inherited from the Vehicle parent class,the Car class will have
the following instance variables:
- numSeats (number of seats in the Car)
- isSUV (indicating whether the Car is a sport utility vehicle -- SUV).
In addition to the instance variables inherited from the Vehicle class,the Truck class will have the
following instance variables:
- isSemi (True if the truck is a transport truck, False if the truck is another type -- i.e. cube
truck/pickup).
- loadCapacity (the weight that the truck can hold, measured in pounds).
The Motorcycle class will inherit all of its instance variables from the Vehicle class. Think about:
why might we choose to create a Motorcycle class if it inherits all of the instance variables and
methods from the vehicle class but doesn't specify any of its own instance variables or override any
of the methods from the Vehicle class?
The CarOwner class will include the following instance variables:
- name (the name of a driver)
- age (the age of a driver)
- gender (the gender of a driver)
- licenseNumber (the license number of a driver)
- yearsDriving (the number of years that a driver has been driving).
The Registry class will include two elds:
- vehicleCollection (an arraylist to hold a collection of vehicle objects currently registered in the
province.)
- numVehicles (the number of vehicles currently registered in the province).