logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Pooja DTechnical writing
(/5)

969 Answers

Hire Me
expert
Emily PersGeneral article writing
(5/5)

776 Answers

Hire Me
expert
Joan DomettEngineering
(4/5)

657 Answers

Hire Me
expert
Neha SharmaaStatistics
(5/5)

1156 Answers

Hire Me
Python Programming

object-oriented programming to write an application for a company that uses a subscription-based business model to loan out clothes such as office and party wear to female clients.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Question 1

Use object-oriented programming to write an application for a company that uses a subscription-based business model to loan out clothes such as office and party wear to female clients.

A subscription costs $69 per 4 weeks. A client can make unlimited loan requests during her subscription, as long as she has no previous loan that has not been returned. There can be only one piece of clothes in each loan request.

The chosen piece of clothes takes a day to be delivered. For example, if a piece of clothes is selected on Wednesday (say, 4th September 2019), then it will arrive at the address of the client the following day, that is, Thursday, 5th 2019

The subscription is automatically renewed. To cancel subscription, a client must

  • not have any loan that is unreturned,

  • pay up any outstanding balance, and

  • call to cancel before week 4 of each 4-week cycle. The UML diagram for the application is shown in Figure

 

Write the following classes:

(a)    Client

  • The object attributes are client id, name and address. The constructor has three parameters to initialise the three object

There are accessor methods for all object attributes, and a mutator method for the address.

  • A addPayment method has a parameter amount which is added to the client’s balance if the amount is positive, and the method returns True. Otherwise, the method returns

  • A makePayment method that has a parameter amount which is subtracted from balance if the amount is positive, and the method returns True. Otherwise, the method returns False. Note that the balance may become negative, and it means that the client has paid 

  • A str method that returns the object attributes as a string in the format shown here:

Test the class by creating the client in the example, and then invoke the methods you have written on the client object.

(2 marks)

(b)    Clothes

  • The object attributes are clothes id, brand, size, price and loan status. The loan status records True if the piece of clothes is currently loaned out, and False

The constructor has four parameters to initialise the first four attributes. Set loan status to False.

There are accessor methods for each object attribute, and a mutator method for loan status.

  • The str method returns all the values of the attributes as a string, with yes or

no based on the loan status. Two examples are shown below:

Test the class by creating the two Clothes objects in the example, and then invoke the methods you have written on the Clothes objects.

(3 marks)

(c)    Subscription

  • The object attributes are the subscription id, start date of subscription, client who made the subscription, the piece of clothes loaned under the subscription, if any, the date on which the piece of clothes is delivered to the client if there is a loan, and the date on which the piece of clothes is returned, if the loan has been

The constructor has two parameters to initialise the client and the start date of subscription. The subscription id is generated using a running number, implemented with a class attribute, _nextId. The subscription id of the first subscription is 1. The subscription id of the second subscription is 2, and so on. The piece of clothes, delivered date and return date are initialised to None.

There are accessor methods for each object attribute, and mutator methods for the piece of clothes, delivery date and return date.

  • Another class attribute records the subscription rate which is $69.

A class method getSubscriptionRate returns the subscription rate.

  • A returnClothes method has one parameter, return date, and method returns False if

    • there is no outstanding piece of clothes for the subscription or

    • the return date is before the date that the piece of clothes is delivered. Otherwise, the method handles the return of the piece of loaned clothes by setting the loan status of the piece of clothes to False, the object attribute

clothes to None, and updates the return date in the subscription. The method then returns True.

  • A requestClothes method has two parameters, the request date and the piece of clothes. The method returns False if

    • a loan by the client has not been returned, or

    • the requested piece of clothes is currently already loaned out, or

    • the request date is before the start date of the subscription, or

    • the request date is before the returned date of the last

Otherwise, the method handles the request to loan a piece of clothes by setting the delivered date for the piece of clothes to be one day after the request date, the loan status of the requested piece of clothes to True, the object attribute clothes to the requested piece of clothes, and returns True.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

389 Experts Online