4 Commits
Author SHA1 Message Date
MehrdadShirvani 6cb8f9a8d8 Update README.md 2026-04-27 04:57:05 +00:00
MehrdadShirvani 4e9b7eb7ea fix: structure 2026-04-27 08:27:31 +03:30
MehrdadShirvani 7eefa807a3 fix: add more details for bonus part 2026-04-27 08:21:49 +03:30
MehrdadShirvani 22fc28130e fix: make comments clear and detailed 2026-04-27 08:21:32 +03:30
5 changed files with 16 additions and 5 deletions
+11 -4
View File
@@ -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! :)
+1
View File
@@ -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:
+2
View File
@@ -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
+2
View File
@@ -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
} }
-1
View File
@@ -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
} }