Just did part 5 exercise 11 and it is all good the code is right and used the test file to check it too, but for submitting it to tmc it takes forever.
public class Apartment {
private int rooms;
private int squares;
private int princePerSquare;
public Apartment(int rooms, int squares, int pricePerSquare) {
this.rooms = rooms;
this.squares = squares;
this.princePerSquare = pricePerSquare;
}
public boolean largerThan(Apartment compared){
if(this.rooms > compared.rooms){
return true;
}
if(this.rooms < compared.rooms){
return false;
}
if(this.squares > compared.squares){
return true;
}
if(this.squares < compared.squares){
return false;
}
if(this.princePerSquare > compared.princePerSquare){
return true;
}
if(this.princePerSquare < compared.princePerSquare){
return false;
}
return false;
}
public int priceDifference(Apartment compared){
int a = this.squares * this.princePerSquare;
int b = compared.squares * compared.princePerSquare;
if(a > b){
return a - b;
} else {
return b - a;
}
}
public boolean moreExpensiveThan(Apartment compared){
int a = this.squares * this.princePerSquare;
int b = compared.squares * compared.princePerSquare;
if(a > b){
return true;
} else {
return false;
}
}
}
could give reasons why this is happening