Dear students,
In this assignment, you need to submit you work to implement a project which demonstrates your knowledge on mainly inheritance, polymorphism and abstraction.
- Vehicle class
- Car class (a subclass of the Account)
- Motorcycle class (a subclass of the Account)
- Main
It should have the following fields and the methods:
Fields:
- id - (String - autogenerated)
- brand - (String)
- year - (Integer)
Methods:
- a parametrized constructor to initialize fields
- a getter method for each field
- a setter method for brand and year
- an abstract method named startEngine()
It should have the following fields and the methods:
Fields:
- numberOfSeats - (Integer)
Methods:
- a parametrized constructor that initializes the numberOfSeats field with the value 5
- a parametrized constructor that initializes all the fields with the input parameters
- getter and setter methods for the field
- overrriden startEngine() method that prints "Car engine starts..."
It should have the following fields and the methods:
Fields:
- hasSidecar - (Boolean)
Methods:
- a parametrized constructor that initializes the hasSideCar field with the value false
- a parametrized constructor that initializes all the fields with the input parameters
- getter and setter methods for the field
- overrriden startEngine() method that prints "Motorcycle engine starts..."
- Please, carefully follow the instructions above.
- Your program should properly enforce encapsulation, inheritance, abstraction and polymorphism.
- Your program should prevent invalid operations using proper exceptions and exception handling. Some of them are
the following:
- number of numberOfSeats cannot be less than 1
- year cannot be in the future, etc.
You will need to define a Main class which demonstrates all the functionality of your program. However, it is strongly encouraged to test each class and each method as soon as they are completed to have less errors and easy debugging in the end.
Define a method race()in the Main class that accepts and array of Vehicles and simulates a race. In the method call startEngine() of each vehicle in the array to print the relevant message.
Create a JavaDoc comment and explain the inheritance and polymorphism principles in the application.
When you compile, make sure your .class files are totally isolated from the rest and are never commited and pushed.
Draw the class diagrams including all the relations among the classes. Add the image(s) to the project folder so that they are submitted to the repository as well. You may use any tool to draw the diagrams. Make sure you submit image format (.jpg or .png).- Record a short video not exceeding 5 minutes to explain the code as well as the way users can interact with the
end product
- Show:
- main blocks of the code base
- each of the features mentioned above
- Upload the video to YouTube and share the link by adding it to your README.md file as the first line (Note: do not empty the READMY.md file).
- Submissions without a video recording will not be graded.
- Please, also refer to the course syllabus about the assignments.
- Each completed feature must be commited and pushed works submitted in just one or two commits are not acceptable.
- This assignment will give you 10 % of the overall.