Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cb8f9a8d8 | ||
|
|
4e9b7eb7ea | ||
|
|
7eefa807a3 | ||
|
|
22fc28130e |
@@ -41,9 +41,9 @@ The project consists of the following classes and interfaces:
|
||||
| GasCar | | ElectricCar |
|
||||
| (Class) | | (Class) |
|
||||
+-------------------+ +-------------------+
|
||||
^ ^ ^
|
||||
^ | |
|
||||
| extends | implements | implements
|
||||
| | |
|
||||
| ⌄ ⌄
|
||||
+-------------------+ +-------------------+ +-------------------+
|
||||
| SportsCar | | Refuelable | | Chargeable |
|
||||
| (Class) | | (Interface) | | (Interface) |
|
||||
@@ -118,7 +118,14 @@ Add a `HybridCar` class
|
||||
- Create a `HybridCar` class that extends `Car`.
|
||||
- It will need variables for both battery level and fuel level
|
||||
- Implement `Refuelable` and `Chargeable` together
|
||||
- (Optional) Override methods to manage both power sources (driving drains battery first, then gas)
|
||||
- Service logic for HybridCar:
|
||||
```
|
||||
needsService(): return true if mileage > 10000
|
||||
performService():
|
||||
Print "Engine oil changed and battery system checked"
|
||||
Reset fuelLevel to 100
|
||||
Reset chargeLevel to 100
|
||||
```
|
||||
|
||||
## Workflow
|
||||
1. Fork the repository to your own Git account
|
||||
@@ -133,6 +140,6 @@ git checkout -b develop
|
||||
```
|
||||
git push origin develop
|
||||
```
|
||||
7. Create a Pull Request from `develop` to `main`
|
||||
7. Create a Pull Request from `develop` to `main` or `master`
|
||||
|
||||
# GOOD LUCK! :)
|
||||
|
||||
@@ -25,6 +25,7 @@ public abstract class Car extends Vehicle implements Serviceable {
|
||||
// TODO: Override getEnergyType() → return "Unknown"
|
||||
|
||||
// TODO: Override showDetails()
|
||||
// Print brand, model, year, mileage, and number of seats
|
||||
|
||||
/*
|
||||
* Implement Serviceable methods:
|
||||
|
||||
@@ -30,6 +30,8 @@ public class ElectricCar extends Car implements Chargeable {
|
||||
// TODO: Override getEnergyType() → return "Electric"
|
||||
|
||||
// TODO: Override showDetails()
|
||||
// Call super.showDetails()
|
||||
// Print battery capacity and charge level
|
||||
|
||||
// TODO: Implement charge(double amount)
|
||||
// Validate negative
|
||||
|
||||
@@ -34,4 +34,6 @@ public class GasCar extends Car implements Refuelable {
|
||||
// Cap at 100
|
||||
|
||||
// TODO: Override showDetails()
|
||||
// Call super.showDetails()
|
||||
// Print fuel level and fuel type
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ public class SportsCar extends GasCar {
|
||||
}
|
||||
|
||||
// TODO: Override showDetails()
|
||||
// Print header
|
||||
// Call super.showDetails()
|
||||
// Print acceleration time
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user