This commit is contained in:
2025-09-23 17:21:41 -04:00
parent 7c3ea29d60
commit 3bf2434a69
3 changed files with 4 additions and 9 deletions

View File

@@ -30,21 +30,20 @@ public final class CabinReservation extends Reservation {
physical_address.getZip())); physical_address.getZip()));
} }
@Override
public String ReservationType() { public String ReservationType() {
return "CabinReservation"; return "CabinReservation";
} }
@Override @Override
public boolean checkValid() throws IllegalArgumentException { public boolean checkValid() throws IllegalArgumentException {
boolean result = false;
if (getPhysical_address() == null) { if (getPhysical_address() == null) {
throw new IllegalArgumentException(String.format("not valid, physical_address %s", this.getReservation_number())); throw new IllegalArgumentException(String.format("not valid, physical_address %s", this.getReservation_number()));
} }
if (getMailing_address() == null) { if (getMailing_address() == null) {
throw new IllegalArgumentException(String.format("not valid, mailing_address: %s", this.getReservation_number())); throw new IllegalArgumentException(String.format("not valid, mailing_address: %s", this.getReservation_number()));
} }
result = true; return true;
return result;
} }
@Override @Override

View File

@@ -50,7 +50,6 @@ public final class HotelReservation extends Reservation{
@Override @Override
public boolean checkValid() throws IllegalArgumentException { public boolean checkValid() throws IllegalArgumentException {
boolean result = false;
if (getNumberOfBathRooms() != 1) { if (getNumberOfBathRooms() != 1) {
throw new IllegalArgumentException("not valid, Baths"); throw new IllegalArgumentException("not valid, Baths");
} }
@@ -66,8 +65,7 @@ public final class HotelReservation extends Reservation{
if (getMailing_address() == null) { if (getMailing_address() == null) {
throw new IllegalArgumentException(String.format("not valid, mailing_address: %s", this.getReservation_number())); throw new IllegalArgumentException(String.format("not valid, mailing_address: %s", this.getReservation_number()));
} }
result = true; return true;
return result;
} }
@Override @Override

View File

@@ -47,15 +47,13 @@ public final class HouseReservation extends Reservation {
@Override @Override
public boolean checkValid() throws IllegalArgumentException { public boolean checkValid() throws IllegalArgumentException {
boolean result = false;
if (getPhysical_address() == null) { if (getPhysical_address() == null) {
throw new IllegalArgumentException(String.format("not valid, physical_address %s", this.getReservation_number())); throw new IllegalArgumentException(String.format("not valid, physical_address %s", this.getReservation_number()));
} }
if (getMailing_address() == null) { if (getMailing_address() == null) {
throw new IllegalArgumentException(String.format("not valid, mailing_address: %s", this.getReservation_number())); throw new IllegalArgumentException(String.format("not valid, mailing_address: %s", this.getReservation_number()));
} }
result = true; return true;
return result;
} }
// House price plus additional flat fee for additional space per day // House price plus additional flat fee for additional space per day