cleanup
This commit is contained in:
@@ -50,6 +50,8 @@ public final class TestReservations {
|
||||
hotel.setNumberOfFloors(1);
|
||||
hotel.setNumberOfBedRooms(2);
|
||||
hotel.setSquareFeet(450);
|
||||
hotel.setReservation_start_date(ZonedDateTime.of(2025, 07, 05, 10, 0, 0, 0, ZoneId.of("UTC")));
|
||||
hotel.setReservation_end_date(ZonedDateTime.of(2025, 11, 30, 22, 0, 0, 0, ZoneId.of("UTC")));
|
||||
boolean success1 = mgr.addReservation(mgr.retrieveAccount(acct.account_number()), hotel);
|
||||
assert success1;
|
||||
|
||||
@@ -62,6 +64,8 @@ public final class TestReservations {
|
||||
cabin.setNumberOfFloors(2);
|
||||
cabin.setNumberOfBedRooms(3);
|
||||
cabin.setSquareFeet(806);
|
||||
cabin.setReservation_start_date(ZonedDateTime.of(2025, 07, 05, 10, 0, 0, 0, ZoneId.of("UTC")));
|
||||
cabin.setReservation_end_date(ZonedDateTime.of(2025, 11, 30, 22, 0, 0, 0, ZoneId.of("UTC")));
|
||||
boolean success2 = mgr.addReservation(mgr.retrieveAccount(acct.account_number()), cabin);
|
||||
assert success2;
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ package lodge.reservationsystem;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import com.google.gson.InstanceCreator;
|
||||
|
||||
public final class CabinReservation extends Reservation implements InstanceCreator<Reservation>{
|
||||
public final class CabinReservation extends Reservation{
|
||||
|
||||
public final String ReservationType() {
|
||||
type='C';
|
||||
@@ -17,9 +15,4 @@ public final class CabinReservation extends Reservation implements InstanceCrea
|
||||
return price;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reservation createInstance(Type type) {
|
||||
System.out.println( String.format( "%s.", this.type));
|
||||
return new CabinReservation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ final class DataRepository {
|
||||
Address ad = null;
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
System.out.println(String.format("Load Account %s", name));
|
||||
String.format("Load Account %s", name);
|
||||
switch (name) {
|
||||
case "Account":
|
||||
jsonReader.beginObject();
|
||||
@@ -88,14 +88,14 @@ final class DataRepository {
|
||||
break;
|
||||
case "Address":
|
||||
jsonReader.beginObject();
|
||||
System.out.println(jsonReader.nextName());
|
||||
jsonReader.nextName();
|
||||
ad = new Address();
|
||||
ad.setStreet(jsonReader.nextString());
|
||||
System.out.println(jsonReader.nextName());
|
||||
jsonReader.nextName();
|
||||
ad.setCity(jsonReader.nextString());
|
||||
System.out.println(jsonReader.nextName());
|
||||
jsonReader.nextName();
|
||||
ad.setState(jsonReader.nextString());
|
||||
System.out.println(jsonReader.nextName());
|
||||
jsonReader.nextName();
|
||||
ad.setZip(jsonReader.nextString());
|
||||
jsonReader.endObject();
|
||||
jsonReader.endObject();
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package lodge.reservationsystem;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import com.google.gson.InstanceCreator;
|
||||
|
||||
public final class HotelReservation extends Reservation implements InstanceCreator<Reservation>{
|
||||
public final class HotelReservation extends Reservation{
|
||||
|
||||
public final String ReservationType() {
|
||||
type = 'H';
|
||||
@@ -17,10 +13,4 @@ public final class HotelReservation extends Reservation implements InstanceCreat
|
||||
// flat fee
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reservation createInstance(Type type) {
|
||||
System.out.println( String.format( "%s.", this.type));
|
||||
return (Reservation) new HotelReservation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package lodge.reservationsystem;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import com.google.gson.InstanceCreator;
|
||||
|
||||
public final class HouseReservation extends Reservation implements InstanceCreator<Reservation>{
|
||||
public final class HouseReservation extends Reservation{
|
||||
|
||||
public final String ReservationType() {
|
||||
type = 'Z';
|
||||
@@ -15,10 +11,4 @@ public final class HouseReservation extends Reservation implements InstanceCreat
|
||||
public float calculatePrice() {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reservation createInstance(Type type) {
|
||||
System.out.println( String.format( "%s.", this.type));
|
||||
return new HouseReservation();
|
||||
}
|
||||
}
|
||||
@@ -222,8 +222,6 @@ public abstract class Reservation{
|
||||
|
||||
public abstract String ReservationType();
|
||||
|
||||
public abstract float calculatePrice();
|
||||
|
||||
public abstract Reservation createInstance(Type type);
|
||||
public abstract float calculatePrice();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user