Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

DU Programming Project

DU Programming Project

DU Programming Project

Description

Q1 (06 marks) Let us suppose that you are designing an e-commerce application for an ABC
company. The company keeps a detailed record and offers a loyalty card to each of its customers.
The customers can accumulate loyalty points through their purchases and can also get discounts
based on their loyalty points. Now, you are trying to design a class to represent these customers.
Your highly productive partner already designed a class called Customer using the provided interface
ICustomer. However, currently, the class does not follow the single responsibility principle (SRP),
which leads to several unexpected issues. For example, discount rate cannot be changed without
modifying the code from Customer class, which is undesirable. To solve this issue, you will use
an attribute (or delegate) namely Membership to the customer entity where the membership is
connected to a discount calculation rule. Using this attribute, you will move the business logic of
calculating discount to elsewhere and thus will make sure that every class follows SRP. (Remember
the salary calculation example from Lecture 11 on SOLID principles). Please do the following.
ˆ Run CustomerTest class and see the testCustomer() method to pass
and the testCustomerWithSRP() method to fail.
ˆ The assignment code contains an incomplete, buggy implementation of CustomerSRP,
Membership and DiscountCalculator. The testCustomerWithSRP() method is also not
passing. Add the missing code to these three classes so that each of them follows the single responsibility principle (SRP). The modified code should pass all the tests from the
CustomerTest class. Once done, make a separate commit with an appropriate message to
GitLab and attach a screenshot of the passing tests to the answer PDF (06 marks).

Q2 (06 marks): Let us suppose that ABC superstore wants you to design a loyalty card application. Each of its customers owns a card that is loaded with a few loyalty points. The customers can
accumulate more points through their purchases. The application should allow the customers to
(a) convert their loyalty points into cash, (b) transfer their points to another card, and (c) buy the
fresh produce from the store. Interestingly, ABC has an old, incomplete version of the application
called LoyaltyCard that implements the first two requirements. However, it does not follow the
open/closed principle (OCP), which leads to several issues. For example, LoyaltyCard cannot be
extended without modifying its code or behaviour, which could be risky. You will design a new
version namely SmartLoyaltyCard that implements all three requirements above and follows OCP.
That is, one should be able to extend SmartLoyaltyCard application (e.g., adding another benefit
for the customers) later without modifying its code. (Remember the example of CloudPersistence
from Lecture 11). Please do the following.
ˆ Run LoyaltyCardTest class and see the testOldCardOperations() method to pass
and the rest test methods to fail.
ˆ The assignment code contains an incomplete, buggy implementation of SmartLoyaltyCard,
CashInTransaction, TransferTransaction and BuyProduceTransaction, and the corresponding test methods are not currently passing. Add the missing code to these four classes
and ensure that SmartLoyaltyCard follows the open/closed principle (OCP). The new code
should pass all the tests from LoyaltyCardTest class. Once done, make a separate commit
with an appropriate message to GitLab and attach a screenshot of the passing tests to the
answer PDF (06 marks).

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20