Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Module Code & Module Title:

CS4001NT Programming

Assessment Weightage & Type:


Individual Coursework Initiation

Year and Semester:


2024 Spring

Student Name: Bhoj Bahadur Khadka


London Met ID:
College ID:np05cp4s240074@iic.edu.np
Assignment Due Date:
Word Count:

I confirm that I understand my coursework needs to be submitted online via MySecondTeacher under the
relevant module page before the deadline in order for my assignment to be accepted and marked. I am
fully aware that late submissions will be treated as non-submission and a mark of zero will be awarded.
1) The Store class has six attributes, which correspond to the store id, store name,
location, opening hour, total sales and total discount. The store name, location and
opening hour are each represented as a string of text, store id as a whole number and
total sales, total discount as double. The constructor accepts four parameters which are
store id, store name, location and opening hour. The attributes total sales and total
discount is initialized to zero. Additionally, assign store id, store name, location and
opening hour with the parameter values. Each attribute has a corresponding accessor
method. A method is required to set total Sales. The method accepts a new total sales
as a parameter. This method will add the new sales to the previous total sales. And, the
new total sales will be set to corresponding parameter value. A method is required to
set total discount. The method accepts a new discount as a parameter. This method will
add the new discount price to previous discount. And, the new total discount will be set
to the corresponding parameter value. A display method should output (suitably
annotated) the store id, store name, location, opening hour and total sales. If the total
sales and total discount price is zero, display a suitable message.
2) The Department class is also a subclass of Store class and it has four attributes:
Product name - a String Marked price - a double Selling price - a double isInSales -
either true or false (boolean) The constructor accepts eight parameters which are store
id, store name, 5 location, opening hour, total sales, total discount, product name and
marked price. A call is made to the superclass constructor with four parameters and two
setter method of total sales and total discount. The attribute isInSales is set to true and
selling price is set to zero. Also, assign other attributes with corresponding parameter
values. Each attribute has a corresponding accessor method. Create a mutator method
for attribute: marked price. There is a method named calculateDiscountPrice. This
method is used to calculate the selling price of the product. The method accepts
isInSales as a parameter and marked price. If the product is available for sales, then,
the discount will be calculated based on the marked price: A 5000 and above 20%
B 3000 and less than 5000 10% C 1000 and less than 3000 5% D less
than 1000 0% [Note: S.P = MP – MP * discount %] Now, the attribute selling price will
be calculated after the price is discounted. Also, call the mutator method total
discounted price from the parent class and total sales as well. It means the product has
been sold and the attribute isInSales is set to false. A method to display the details of
the Department is required. It must have the same signature as the display method in
the parent class. It will call the method in the super class to display all the attribute of
super class. If the product is in sales, display product name and marked price however,
if the product is not in sale, display product name and selling price.
3) The Retailer class is a subclass of Store class and has five attributes: VAT inclusive
price - an integer Loyalty point - an Integer isPaymentOnline - a Boolean
purchasedYear - a String 6 The constructor accepts nine parameters which are store id,
store name, location, opening hour, total sales, total discount, VAT inclusive price,
isPaymentOnline and purchasedYear. A call is made to the superclass constructor with
four parameters and setter method total sales and total discount. Additionally, in the
constructor, assign VAT inclusive price, isPaymentOnline, purchasedYear with the
corresponding parameter value and loyalty point is set to zero. Each attribute has a
corresponding accessor method. Create a mutator method for attribute:
isPaymentOnline A method is required to set the loyalty point as the payment is made
from the online. The method accepts new isPaymentOnline and new VAT inclusive
price as a parameter and if the payment is online then the customer will get loyalty point.
The loyalty point will be generated based on the VAT payment by customer, the loyalty
point will be 1% of the VAT price. Then the loyalty point will be assigned to the
corresponding parameter value. Note: Loyalty point = 1% of VAT inclusive price There
is a method named removeProduct. This method will remove the product if the product
doesn’t have loyalty point and purchased year is equal to 2020 or 2021 or 2022, then
the product will be removed since a product cannot be older than 1 year. Then, VAT
inclusive price, loyalty point is set to zero, isPaymentOnline is set to false. A method to
display the details of the Retailer class is required. It must have the same signature as
the display method in the Store class. If the product has not yet been removed, it will
call the method in the super class to display all the attribute of super class. Also, display
attributes VAT inclusive price, loyalty point and purchased year. If the product has been
removed, call the display details of super class and print a suitable message. Each
output must be suitably annotated.

You might also like