Skip to content
Snippets Groups Projects

feature/rent

Open Axel Kirst requested to merge feature/rent into develop
3 files
+ 39
2
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 21
2
@@ -5,7 +5,9 @@ public class Car {
private int id;
private int cost;
private int monthlyCost;
private boolean taken;
private int rentDuration;
private boolean sold;
public Car(int id, int cost) {
@@ -14,6 +16,23 @@ public class Car {
this.sold = false;
}
public void rent(int dur){
this.taken = true;
this.rentDuration = dur;
}
public int rentCost() {
return this.monthlyCost;
}
public int duration(){
return this.rentDuration;
}
public boolean isRented(){
return this.taken;
}
public void sell() {
this.sold = true;
}
@@ -33,6 +52,6 @@ public class Car {
public boolean isAvailable() {
// check if a car is available (not sold or not rented)
return !isSold();
return !isSold() && !isRented();
}
}
Loading