matin mortazavi / I debugged the code. The issue was that it couldn’t recognize the file paths
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package org.model;
|
||||
|
||||
/*
|
||||
* Car extends Vehicle.
|
||||
* This class SHOULD implement Serviceable.
|
||||
*
|
||||
* Service logic for Car:
|
||||
* - needsService(): return true if mileage > 10,000
|
||||
* - performService(): print "General car service completed"
|
||||
*/
|
||||
|
||||
import org.behavior.Serviceable;
|
||||
|
||||
public abstract class Car extends org.model.Vehicle implements Serviceable {
|
||||
|
||||
private int seats;
|
||||
|
||||
public Car(String brand, String model, int year,
|
||||
double mileage, int seats) {
|
||||
|
||||
// TODO: Call super constructor
|
||||
super(brand , model , year , mileage );
|
||||
this.seats = seats;
|
||||
}
|
||||
|
||||
// TODO: Override getEnergyType() → return "Unknown"
|
||||
@Override
|
||||
public String getEnergyType()
|
||||
{
|
||||
return "Unknown" ;
|
||||
}
|
||||
|
||||
// TODO: Override showDetails()
|
||||
@Override
|
||||
public void showDetails()
|
||||
{
|
||||
System.out.println("brand : " + GetBrand()) ;
|
||||
System.out.println("model : " + GetModel() ) ;
|
||||
System.out.println("year : " + GetYear() ) ;
|
||||
System.out.println("mileage : " + GetMileage()) ;
|
||||
System.out.println("seats : " + seats) ;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement Serviceable methods:
|
||||
*
|
||||
* needsService(Vehicle v):
|
||||
* - Check the mileage of the current car
|
||||
* - If mileage > 10000 return true
|
||||
* - Otherwise return false
|
||||
*
|
||||
* performService():
|
||||
* - Print: "General car service completed"
|
||||
*/
|
||||
@Override
|
||||
public boolean needsService(org.model.Vehicle v)
|
||||
{
|
||||
return this.GetMileage() > 10000 ;
|
||||
}
|
||||
|
||||
public abstract boolean needService(org.model.Vehicle v);
|
||||
|
||||
@Override public void performService(){
|
||||
System.out.println("General car service completed") ;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user