Compare commits
2
Commits
e8aedb8354
...
7eefa807a3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7eefa807a3 | ||
|
|
22fc28130e |
@@ -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
|
||||||
|
|||||||
@@ -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