implement toString

This commit is contained in:
2025-08-29 07:26:53 -04:00
parent 708126e172
commit 052391d7a0
6 changed files with 104 additions and 58 deletions

View File

@@ -5,8 +5,10 @@ import java.net.URI;
import lodge.reservationsystem.AccomodationManager;
import lodge.reservationsystem.Account;
import lodge.reservationsystem.Address;
import lodge.reservationsystem.CabinReservation;
import lodge.reservationsystem.DataRepository;
import lodge.reservationsystem.EmailAddress;
import lodge.reservationsystem.Reservation;
public final class TestReservations {
public static void main(String[] args) throws Exception {
@@ -31,28 +33,30 @@ public final class TestReservations {
Account acct = mgr.newAccount("767-456-7890",
new Address("10 wilco ave", "wilco", "WY", "82801"),
new EmailAddress("wilco@wyommin.net"));
mgr.AddAccount(acct);
// 4. Request that Manager updates specific accounts files with data stored in
// memory
mgr.AddAccount(acct);
mgr.UpdateAccount(mgr.retrieveAccount(acct.account_number()));
// 5. Add draft lodging reservation to an account (if reservation object already
// exists with the same reservation number, it is considered an error)
mgr.UpdateAccount(mgr.retrieveAccount(acct.account_number()));
CabinReservation cabin = new CabinReservation();
cabin.setPhysical_address(new Address("30 cabin ave", "Carnelian", "CA", "96140"));
cabin.setMailing_address(new Address("40 cabin ave", "Carnelian Bay", "CA", "96140"));
cabin.setNumberOfBeds(4);
cabin.setNumberOfFloors(2);
cabin.setNumberOfBedRooms(3);
cabin.setSquareFeet(806);
mgr.addReservation( mgr.retrieveAccount(acct.account_number()), cabin);
// 6. Complete reservation that is associated with an account
Reservation rsrv = mgr.retreiveReservation("R######");
rsrv.Complete();
/*
* if (acct != null)
* acct.addReservation(new HotelReservation());
*
* // 6. Complete reservation that is associated with an account
* Reservation rsrv = null;
* acct = null;
* acct = mgr.retrieveAccount("A######");
* if (acct != null) {
* rsrv = acct.retrieve("?######");
* rsrv.Complete();
* }
*
//mgr.UpdateAccount(mgr.retrieveAccount(acct.account_number()));
/*
* // 7. Cancel reservation that is associated with an account
* if (acct != null) {
* rsrv = acct.retrieve("?######");