1. Homepage
  2. Programming
  3. ICT162 Object Oriented Programming - Assignment: SAMI Hotel

ICT162 Object Oriented Programming - Assignment: SAMI Hotel

Engage in a Conversation
SingaporeSUSSSINGAPORE UNIVERSITY OF SOCIAL SCIENCESPythonICT162ICT 162Object Oriented Programming

ICT162 Tutor-Marked Assignment CourseNana.COM

This assignment is worth 24% of the final mark for ICT162, Object Oriented Programming . CourseNana.COM

The cut-off date for this assignment is Wednesday, 26 April 2023, 2355 hrs . CourseNana.COM

Note to Students: Submit your solution document in the form of a single MS Word file. You are to include the following particulars in your submission: Course Code, Title of the TMA, SUSS PI No., Your Name, and Submission Date. Put this information in the first page of your solution document. Use the template word document provided – SUSS_PI_No-FullName_162TMA.docx. Rename the file with your SUSS_PI_No, FullName, and read the submission details under Module\TMA01 in the ICT162 L01 . Do NOT submit as a pdf document . You should make only one submission for TMA. You are to copy and paste Python source code into your solution document as text. If you submit source code as image, no marks will be awarded to your program. Submit screenshots for only output of your program, where applicable. CourseNana.COM

Assignment Requirements:  Unless specified in the question, you CANNOT use packages not covered in this module, e.g., re, collections, numpy, pandas etc.  All classes must be documented. Provide sufficient comments to your code and ensure that your program adheres to good programming practices such as not using global variables.  Failing to do so can incur a penalty of as much as 50% of the mark allotted. CourseNana.COM

To start, SAMI will rollout 2 types of room – Standard (2m x 2.1m) and Deluxe (2.3m x 2.1m). During the booking, guests will first select a room type, then they will decide on their preferred bed type – Single (1.9m x 0.91m) or Super (1.9m x 1.07m). By default, the bed includes a pillow and a blanket. SAMI will also offer the following type of amenities, as “option” for guests to add-on.  General: Wi-Fi, Gym Pass, Pool Pass, Pillow, Blanket  Toiletries: Shampoo, Shower Gel, Bath Towel, Bathrobe, Hand Towel  Personal care: Shaving Cream, Razor, Shower Cap, Hair Dryer, Slippers  Furniture: Walled-TV, Fridge, Bedside Table, Coffee Kit, Writing Desk, Chair Price per day will be the sum of room price, bed price and the selected amenities’ prices. CourseNana.COM

ICT162 Tutor-Marked Assignment Question 1 (5 marks) Let’s start with the Guest. Construct the Guest class according to the specification in the class diagram shown below in Figure Q1. CourseNana.COM

adopted the blacklisting strategy where misbehaving guests are prevented from (future) booking with SAMI. If guest is blacklisted, the list will contain pairings of date and reason for each offence.  Constructor performs the following: o Initialises these 3 instance variables: _passport, _name and _country, with the given Question 2 (15 marks) Demonstrate your understanding of how class hierarchy and association are used to organize information, and then construct the class hierarchy and association according to specification. Study the class diagram in Figure Q2, which focuses on the Amenity class and its subclasses. CourseNana.COM

Figure Q2 (a) Implement the abstract class – Amenity. CourseNana.COM

The Amenity class has:  THREE instance variables: o _itemCode (str): unique code for this amenity item, e.g., “GYM_PEP”. o _description (str): description of the amenity, e.g., “Per entry pass to gym (Level CourseNana.COM

The SharedAmenity class is also a subclass of Amenity.  No additional instance variable.  For shared amenities, the method getFloorArea returns 0, as these amenities are mostly in shared/common area, or not occupying any floor area of the room. E.g., gym, swimming pool, Wi-Fi etc. (5 marks) CourseNana.COM

(c) Write a main() function to do the following: (i) Assemble 4 Amenity objects into a list. o From Appendix A.1, select and create 2 SharedAmenity objects. o From Appendix A.2, select and create 2 InRoomAmenity objects with floor area CourseNana.COM

0.1 m2 (ii) Print the total floor area and total price of the Amenity objects created in Q2(c)(i). CourseNana.COM

(5 marks) ICT162 Tutor-Marked Assignment SINGAPORE UNIVERSITY OF SOCIAL SCIENCES (SUSS) Page 7 of 29 Question 3 (20 marks) As illustrated in the introduction, SAMI follows the minimalist design style – simple, clean, and functional, by providing each room with an open floor plan, allowing guest to select their preferred bed type, and option to add amenities. In Figure Q3, the class diagram is updated with Room and Bed classes, to mimic the hotel room setup. CourseNana.COM

Figure Q3 (a) Implement the Bed class. The Bed class has:  It has a class variable: _TYPE_SIZE that is a Dictionary containing the 2 bed types and their floor area, as key and value respectively.  THREE instance variables: o _type (str): only “Single” or “Super” bed types currently offered by SAMI. CourseNana.COM

ICT162 Tutor-Marked Assignment floorArea is obtained through the class variable _TYPE_SIZE, using the instance variable _type.  The str method returns a string representation of a Bed object, in the following order – description and price, separated by commas: Super single bed with one pillow and one blanket, $12.99 (4 marks) (b) Create the following exception classes.  BookingException – subclass of the Exception class. This class has no added attribute or method. When the application encounters booking rules violation, your application will raise an exception from this class.  MinFloorAreaException – subclass of the Exception class. This class has no added attribute or method. o In Singapore, there is a requirement to maintain a minimum floor area and passageway to facilitate safe and swift exit in event of emergency. o When adding amenities to room, the minimum floor area rule may be violated. Your application will raise an exception from this class. (1 mark) (c) Construct and Implement the Room class. The Room class has:  TWO class variables: o _MIN_EXIT_SPACE: minimum floor area (1.84m2) that should be kept clear. o _TYPE_SIZE that is a Dictionary containing the 2 room types and their floor area, as key and value respectively.  FOUR instance variables: o _type (str): the room type, either “Standard” or “Deluxe”. o _roomPrice (float): representing the price for the room, excluding the bed. o _bed (Bed): the Bed object, which is the preferred bed of the guest. o _amenities (list): a collection (list) containing the “add-on” amenities.  Constructor initialises these 3 instance variables: _type, _roomPrice and _bed using the given parameters. The constructor should set _amenities to an empty list.  Getter method for instance variables: _type and _roomPrice. Use the property decorator.  Define getter method for fullPrice – the sum of room price, bed price and all amenities’ prices. Use the property decorator  The addAmenity method has newItem (Amenity object) as parameter. The following checks need to be performed before adding this newItem into _amenities: o The minimum floor area of 1.84m2 must not be compromised after adding this newItem. If the above condition is not met, raise MinFloorAreaException with appropriate message. o In SAMI, there should not be duplicate amenity in each room, i.e., not more than one, raise BookingException with appropriate message if duplicate CourseNana.COM

Amenity object with the same item code and remove it from the collection _amenities. o If there is no amenity matching the given itemCode, then method should raise BookingException with message stating there is no such amenity in this room.  The str method returns the details of the room, follow by the string representations of bed, amenities, and the full price. Below are two examples: Standard room, $16.99 Super single bed with one pillow and one blanket, $12.99 Full Price: $29.98 CourseNana.COM

o Chair o Writing desk o Iron and ironing Board CourseNana.COM

 Standard room with single bed, and add the following amenities in this order: o Gym pass o Mini fridge o Wi-Fi o Gym pass CourseNana.COM

Print the string representation of the created Room objects. CourseNana.COM

(ii) Remove these amenities from both rooms, in this order:: o Mini fridge o Gym pass CourseNana.COM

Print the string representation of the Room objects, after removal. (5 marks) ICT162 Tutor-Marked Assignment Question 4 (40 marks) This question is a continuation of Question 1, 2 & 3, hence will make use of the classes in Question 1, 2 & 3. To stay in SAMI Hotel, you will need to make a booking. As SAMI only offer rooms for individuals, a booking is made up of ONE guest and ONE room. However, a booking can only be submitted and confirmed if there is room available from the check-in to check-out dates. As SAMI Hotel only offer 2 room types, the room availability is provided through a file and released monthly (see Appendix C). If selected room is available on those dates, a booking ID will be generated once the booking is submitted. On the check-in date, the guest will quote the booking ID when arriving at SAMI Hotel. Room allocation and the rest of hotel operations will be manual. In this question, you will create a prototype application for the booking of rooms in SAMI Hotel. SAMI management will observe the demand and decide later if the application is to enhance to support the rest of Hotel operations. Refer to the Booking class diagram in Figure Q4a and the Hotel class diagram in Figure Q4b. CourseNana.COM

Figure Q4a CourseNana.COM

(a) Implement the Booking class. CourseNana.COM

ICT162 Tutor-Marked Assignment It has a class variable: _NEXT_ID, starting from 1, used for generating running numbers to uniquely identify the booking.  There are SEVEN instance variables: o _bookingID (str): the booking ID to uniquely identify this booking o _guest (Guest): the Guest object, represent the guest who make this booking. o _room (Room): the Room object, representing the room, including the bed and amenities selected by the guest. o _checkInDate (date): check-in date. o _checkOutDate (date) : check-out date. o _allocatedRoomNo (str): this field is empty when booking is made, and will be updated by SAMI when the guest check-in. o _status (str): status of the booking.  Constructor performs the following: o Initialises these 4 instance variables: _guest, _room, _checkInDate and _checkOutDate, using the given parameters. o The _bookingID is generated using the class variable _NEXT_ID, which starts from 1, and increment by 1 for every new booking. o Set _allocatedRoomNo to None, and _status to “Pending”. o Ensure the guest is not backlisted, or check-out date is at least 1 day after check- in date. Otherwise, raise BookingException with appropriate message.  Define the following getter methods, using the property decorator: o Instance variables: _bookingID, _checkInDate, _checkOutDate and _status. o For the following:  passport – returns the passport of the guest.  roomType – returns the room’s type.  totalPrice – returns the product of fullPrice of room and number of nights.  Setter methods for instance variable: _status. Use the property decorator.  Method checkIn will first check if the following rules are not violated: o Current booking status must be “Confirmed”. o The check-in must be done on the _checkInDate itself. o Check that the guest is not blacklisted. o If any of the above condition is not met, raise BookingException with appropriate message. The method then proceed to perform the following: o Update _status to “Checked-In”. o Update _allocatedRoomNo with the given parameter. Figure Q4b You are to complete a partially written Hotel class, given in Appendix E. The Python codes for Hotel class only have constructor and setup methods for guests, amenities, and room availability. CourseNana.COM

Description of the instance variables and constructor of the Hotel class:  It has FIVE instance variables: o _name (str): the name of the hotel. o _guests (dictionary): collection of guests. The key for this dictionary is the passport number, and the value is the Guest object. o _amenities (list): the list of amenities that SAMI is providing. o _bookings (dictionary): collection of bookings. The key for this dictionary is the booking ID, and the value is the Booking object. o _roomAvailability (dictionary): the room availability as shown in Appendix C. The key for this dictionary is the date, and the value is a list holding the standard room count and deluxe room count.  Given name and roomFilename as parameters, the constructor performs the following: o Initialises the instance variable: _name, using the given parameter “name”. o Invoke the setupGuest method – to setup Guest objects into the dictionary by reading the information from “Guests.txt” and “Blacklist.txt”. CourseNana.COM

ICT162 Tutor-Marked Assignment Invoke the setupAmenities method – to setup the current set of Amenity objects into a list using the information provided in Appendix A.1 & A.2. o Invoke the saveRoomAvailability method, with the roomFilename, to setup the room availability as shown in Appendix C. o Setup _bookings as empty dictionary. CourseNana.COM

You are to write the following methods of the Hotel class:  Given a passport (number) as parameter, the method searchGuest searches and returns the Guest object matching this passport number. If not found, the method returns None.  checkRoomAvailability method will return True if there is room (type) available from parameter start (date) to parameter end (date). The method returns False, if: o start date is later than end date. o start or end dates are not in the _roomAvailability dictionary.  listAmenity method returns the string representation of all Amenity objects, concatenated and one Amenity object per line.  Given an itemCode as parameter, the getAmenity method searches and returns the Amenity object that matches the parameter itemCode. If there is no such amenity, the method returns None.  searchBooking method has 1 parameter: bookingID (int). This method searches and returns the Booking object that matches the parameter bookingID. If there is no such booking, the method returns None.  Given passport (str) as parameter, the searchBookingByPassport method searches and returns a list containing all the Booking objects with guest’s passport matching the parameter passport. An empty list is returned if there is no booking found.  The submitBooking method also has a newBooking (Booking object) as parameter. This method is invoked when the booking is ready for submission. The following validation tasks need to be performed: o Check that the newBooking status is “Pending”. o Check that there should be room available for this booking (from check-in to check-out date, for the room type). o If any of the above checks fail, this method should raise BookingException with appropriate messages. If there is no exception, then proceed to: o Update room availability by deducting the room type count from check-in to check-out dates. o Update the booking status to “Confirmed”. o Add this newBooking object into _bookings dictionary.  cancelBooking method has bookingID as parameter and need to perform the following checks: o If there is no booking with this booking ID, then method should raise BookingException with message saying there is no such booking. o If this booking ID can locate a booking, but the booking status is not “Confirmed”, then method should raise BookingException with message stating this booking cannot be cancelled. ICT162 Tutor-Marked Assignment SINGAPORE UNIVERSITY OF SOCIAL SCIENCES (SUSS) Page 14 of 29 o Update the booking status to “Cancelled” and update the room availability data (increment room type count by 1 from check-in to check-out dates)  The checkIn method has 2 parameters: bookingID and allocatedRoomNo. This method will perform the following: o Search for this booking using the given bookingID. o If booking is found, invoke the checkIn method of the Booking object. o If no such booking, then method should raise BookingException with proper message. (18 marks) CourseNana.COM

(c) Write an application that allow SAMI to manage the room booking processes, focusing on the creation, submission, and cancellation of bookings. As this is an experimental project, the actual room allocation and check-in procedure will be done manually. Hence, your application will provide a shortened “Check-In” function to just update the status and room allocated for the bookings. CourseNana.COM

==================== CourseNana.COM

  1. Submit Booking
  2. Cancel Booking
  3. Search Booking(s)
  4. Check-In
  5. Exit Enter option: 1 Enter Passport Number to start: a9001022 Guest located. Please verify

Passport: A9001022 Name: Steve Tan Country: Malaysia CourseNana.COM

Select preferred room type (S)tandard or (D)eluxe): S Select preferred bed type (S)ingle or s(U)per: S CourseNana.COM

WI-FI, One-day Wi-Fi access, $1.00 GYM-PEP, Per entry pass to gym (Level 4-01), $1.00 SWIM-PEP, Per entry pass to swimming pool (Level 2 outdoor), $1.50 BIZ-PEP, Per entry pass to business centre (Level 3-03), $2.00 BREAKFAST, Breakfast buffet at Sun café (Level 1-01, 6am to 10am), $8.99 Hi-TEA, Hi-Tea buffet at Sun café (Level 1-01 2pm to 4pm), $11.99 SHAMPOO-1, One sachet of conditioning shampoo, $0.29 SHOWER-1, One sachet of shower gel, $0.25 TOWEL-B, One bath towel (to return when check-out), $1.50 TOWEL-H, One hand towel (to return when check-out), $1.00 SHOW-CAP, One shower cap, $0.49 SHA-RAZOR, One disposable shaving razor (men’s), $2.99 SHA-CREAM, One sachet of shaving cream (men’s), $0.29 HAIR-DRY, Hair Dryer (to return when check-out), $2.00 SLIPPERS, One pair of disposable slippers , $4.59 WALLED-TV, Walled-TV, $3.99 FRIDGE, Mini Fridge (50L), $4.59 TABLE-B, Bedside table (60cm x 50cm), $2.59 DESK-W, Writing desk (80cm x 55cm), $3.99 CHAIR, Foldable Chair (42cm x 38cm), $2.59 IRON-B, Iron and ironing board (128cm x 30cm), $2.99 CourseNana.COM

Enter item code to add or to stop: wi-fi WI-FI added... CourseNana.COM

List of Amenities

WI-FI, One-day Wi-Fi access, $1.00 GYM-PEP, Per entry pass to gym (Level 4-01), $1.00 SWIM-PEP, Per entry pass to swimming pool (Level 2 outdoor), $1.50 BIZ-PEP, Per entry pass to business centre (Level 3-03), $2.00 BREAKFAST, Breakfast buffet at Sun café (Level 1-01 6am to 10am), $8.99 ICT162 Tutor-Marked Assignment SINGAPORE UNIVERSITY OF SOCIAL SCIENCES (SUSS) Page 16 of 29 . . . WALLED-TV, Walled-TV, $3.99 FRIDGE, Mini Fridge (50L), $4.59 TABLE-B, Bedside table (60cm x 50cm), $2.59 DESK-W, Writing desk (80cm x 55cm), $3.99 CHAIR, Foldable Chair (42cm x 38cm), $2.59 IRON-B, Iron and ironing board (128cm x 30cm), $2.99 CourseNana.COM

o Label “Date Reported:” & “(dd-mon-yyyy)” to guide user input (Entry) for the date of incident. o Label “Reason(s):” to guide user input (Entry) to record reason(s) for blacklisting this guest. o 3 Buttons “Search” (enabled), “Blacklist” (disabled) and “Reset” (disabled). o Scrolled Text (disabled) to display search results, blacklisting outcome, or any messages. In this prototype GUI, re-instating blacklisted guests or removal of incidents are not in scope. (7 marks) CourseNana.COM

ICT162 Tutor-Marked Assignment CourseNana.COM

(b) Implement event handling so that the SAMI Blacklisting GUI can respond to left button clicks on these buttons. CourseNana.COM

Format of the file: CourseNana.COM

Each line of the file contains information in this order: CourseNana.COM

,, 01-Apr-2023,6,4 02-Apr-2023,6,4 03-Apr-2023,1,1 04-Apr-2023,6,4 05-Apr-2023,1,1 06-Apr-2023,6,4 07-Apr-2023,6,4 08-Apr-2023,1,1 09-Apr-2023,6,4 10-Apr-2023,6,4 11-Apr-2023,1,1 12-Apr-2023,6,4 13-Apr-2023,6,4 14-Apr-2023,6,4 15-Apr-2023,6,4 16-Apr-2023,1,1 17-Apr-2023,6,4 18-Apr-2023,6,4 19-Apr-2023,6,4 20-Apr-2023,1,1 21-Apr-2023,6,4 22-Apr-2023,6,4 23-Apr-2023,6,4 24-Apr-2023,1,1 25-Apr-2023,6,4 26-Apr-2023,1,1 27-Apr-2023,6,4 28-Apr-2023,6,4 29-Apr-2023,6,4 30-Apr-2023,6,4 Note: the number of rooms for standard and deluxe are reduced in selected dates to help easier simulation of room unavailability during your testing. ICT162 Tutor-Marked Assignment SINGAPORE UNIVERSITY OF SOCIAL SCIENCES (SUSS) Page 28 of 29 Appendix D.1 – Guests.txt Format of the file: Each line of the file contains information in this order: ,, 123445678, Kyrie Irving, USA E234567Z, Lee Ah Seng, Singapore A9001022, Steve Tan, Malaysia C1899345, Lau Hong Gui, Malaysia PA0010023, Andrew Hewitt, Australia M2375489, Mary Tan, Malaysia Appendix D.2 – Blacklist.txt Format of the file: Each line of the file contains information in this order: ,, 123445678, 12-Feb-2023, Drunk and disorderly 123445678, 12-Feb-2023, Assault employees PA0010023, 12-Mar-2023, Disputing credit card charges PA0010023, 12-Mar-2023, Causes damage to facilities Appendix E – class Hotel Python codes for constructor, including the setup of guests, amenities, and room availability. class Hotel: def __init__(self, name, roomFilename): self._name = name self._guests = self.setupGuests() self._amenities = self.setupAmenities() self._roomAvailability = self.setupRoomAvailability(roomFilename) self._bookings = {} def setupGuests(self): guests = { } infile = open( "Guests.txt" , "r") for line in infile: pp,name,country = line.split( ",") guests[pp.strip()] = Guest(pp.strip(),name.strip(),country.strip()) infile.close() infile = open( "Blacklist.txt" , "r") ICT162 Tutor-Marked Assignment SINGAPORE UNIVERSITY OF SOCIAL SCIENCES (SUSS) Page 29 of 29 for line in infile: pp, dateReported, reason = line.split( ",") g = guests.get(pp.strip()) if g is not None: g.blacklist(datetime.strptime(dateReported.strip(), "%d-%b-%Y" ).date(), reason.strip()) infile.close() return guests def setupAmenities(self): amenities = [ ] infile = open( "SharedAmenity.txt" , "r") for line in infile: itemCode,desc,price = line.split( ",") amenities.append( SharedAmenity(itemCode, desc, float(price))) infile.close() infile = open( "InRoomAmenity.txt" , "r") for line in infile: itemCode,desc,price,floorArea = line.split( ",") amenities.append( InRoomAmenity(itemCode, desc, float(price), float(floorArea))) infile.close() return amenities def setupRoomAvailability(self, filename): roomAvailability = { } infile = open(filename, "r") for line in infile: dateString, standardCount, deluxeCount = line.split( ",") thisDate = datetime.strptime(dateString, "%d-%b-%Y" ).date() roomAvailability[thisDate] = [int(standardCount), int(deluxeCount)] infile.close() return roomAvailability def saveRoomAvailability(self, filename): outfile = open(filename, "w") for k, v in self._roomAvailability.items(): print("{},{},{}" .format(k.strftime( "%d-%b-%Y" ), v[0], v[1]), file=outfile) outfile.close() ---- END OF ASSIGNMENT ----

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Singapore代写,SUSS代写,SINGAPORE UNIVERSITY OF SOCIAL SCIENCES代写,Python代写,ICT162代写,ICT 162代写,Object Oriented Programming代写,Singapore代编,SUSS代编,SINGAPORE UNIVERSITY OF SOCIAL SCIENCES代编,Python代编,ICT162代编,ICT 162代编,Object Oriented Programming代编,Singapore代考,SUSS代考,SINGAPORE UNIVERSITY OF SOCIAL SCIENCES代考,Python代考,ICT162代考,ICT 162代考,Object Oriented Programming代考,Singaporehelp,SUSShelp,SINGAPORE UNIVERSITY OF SOCIAL SCIENCEShelp,Pythonhelp,ICT162help,ICT 162help,Object Oriented Programminghelp,Singapore作业代写,SUSS作业代写,SINGAPORE UNIVERSITY OF SOCIAL SCIENCES作业代写,Python作业代写,ICT162作业代写,ICT 162作业代写,Object Oriented Programming作业代写,Singapore编程代写,SUSS编程代写,SINGAPORE UNIVERSITY OF SOCIAL SCIENCES编程代写,Python编程代写,ICT162编程代写,ICT 162编程代写,Object Oriented Programming编程代写,Singaporeprogramming help,SUSSprogramming help,SINGAPORE UNIVERSITY OF SOCIAL SCIENCESprogramming help,Pythonprogramming help,ICT162programming help,ICT 162programming help,Object Oriented Programmingprogramming help,Singaporeassignment help,SUSSassignment help,SINGAPORE UNIVERSITY OF SOCIAL SCIENCESassignment help,Pythonassignment help,ICT162assignment help,ICT 162assignment help,Object Oriented Programmingassignment help,Singaporesolution,SUSSsolution,SINGAPORE UNIVERSITY OF SOCIAL SCIENCESsolution,Pythonsolution,ICT162solution,ICT 162solution,Object Oriented Programmingsolution,