logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

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.

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. 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. The LineItem class will represent an individual

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

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

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

expert
Um e HaniScience

722 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

575 Answers

Hire Me
expert
Husnain SaeedComputer science

930 Answers

Hire Me
expert
Atharva PatilComputer science

976 Answers

Hire Me