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