COMP642 Advanced Programming Exercise 2 – Object Oriented Programming Worth: 20% Due: Monday 30 August 2021 5:00pm. Late Penalty: Work not received by the due time attracts an immediate penalty of 25% of the marks available. No work will be accepted after Wednesday 1 September 2021 5:00pm. Submission: Zip your completed files and submit the .zip through the link on COMP642 LEARN page. Overview Create a Python application to manage information for a small video rental shop. At the end of this document is the outline of a design for the model (Video and Customer classes) and the VideoStore which acts as the controller. You may base your application on the design at the end of the document or on the one you developed yourself for Exercise 1. Criteria Your application must: Run correctly to the specified requirements Read the supplied files and create the appropriate video and customer objects Allow a video to be rented by a customer Allow a video to be returned by a customer Display full information for a selected customer (including total payment) Display full information for a selected video Display summary information about a customer and the videos they have borrowed Have a user interface with: o appropriate controls o useful feedback o prevention of input errors Your code must: Make appropriate use of the model and controller classes provided or as submitted in Exercise 1 Well-structured and easy to maintain Be appropriately commented COMP642 | OO programming Exercise | Page 2 What you are to do: You are to create a Python application manage the video store. The two files “Customer.txt” and “Video.txt” contain information about customers and videos and can be downloaded from COMP642 web page. 1. Adapt as necessary your design from Exercise 1 (or use the suggested design attached) so that: A video can be rented out to a customer (if the video is available) A video can be returned by a customer (who has rented the video) A payment is charged to the customer when they rent a video. Each customer keeps a list of all the videos they currently rent Every time a video is rented by a customer, the video is appended to the customer’s video list. Every time a video is returned by a customer, this video is removed from the customer’s video list. It provides the following information for customers: o The customer personal information (name, city, etc.) o The list of videos currently rented by the customer o The total amount paid for video rental It should provide the following information for videos (video title, the year and the availability). 2. Write and test the code for all the classes in your design. 3. Write code for an application that uses the classes in your design to: Read the files and create the appropriate customers and
video objects (your Controller will have methods to create these objects) Allow the user to rent a video to a customer Allow the user to return a video from a customer Allow the user to view full information about a selected customer Allow the user to view full information about a selected video Have an appropriately designed view (interface). An example is shown in Figure 1. COMP642 | OO programming Exercise | Page 3 Figure 1- A Video Rental Application View 4. Your application: Does not have to provide facilities for the user to add new videos or customers, or to delete existing objects. Does not have to provide facilities for user to amend details of rental, customers or videos (other than adding videos to the rental list of the customer). Does not have to provide facilities to deal with late returns. Marking Criteria Marks (out of 100) File Read Functionality 10 Rent and Return functionalities 40 View customer and video information 20 User Interface (View) Functionality 10 Coding style, comments, clear logic 20 All videos All customers Rent and return buttons Customer’s information Video’s information COMP642 | OO programming Exercise | Page 4 Possible Design for Exercise 1 class Video: #constructor, need title, year and status def __init__(self, title, year): pass #getter and setter for videoTitle #getter and setter for videoYear #getter and setter for videoStatus def detailInfo(self): #detail information for video pass class Customer: #constructor, need name, city, payment and list of videos def __init(self,cname, ccity): pass #getter and setter for name #getter and setter for city #getter and setter for payment #getter for video list #add a video to the list def addRental(self, aMovie): pass #remove a video from the list def removeVideo(self,aMovie): pass #update payment def updatePayment(self): pass #customer detailed information def info(self): pass COMP642 | OO programming Exercise | Page 5 class VideoStore: #constructor to initialise customer list and video list def __init__(self): pass #add movie to the list def addMovie(self, aMovie): pass #add customer to the list def addCustomer(self): pass #rent a movie, returns a boolean status def rentMovie(self, aCust, aMovie): pass #return a movie def returnMovie(self, aCust, aMovie): pass #find a movie based on a title, returns video object or None def findMovie(self, aTitle): pass #find a customer based on name, returns a customer object or None def findCustomer(self, aName): pass