mercredi 13 juillet 2016

What are the potential software design pattern problems in this scenario?

Design and implement Cash Register:

Given a number of items you will be required to calculate the total bill. Items are charged for in a couple of different ways:

  • A given price for each item, e.g. Boxes of Cheerios are $6.99 each

  • A given price by weight, e.g. Apples are $2.49 per pound

  • Items can go on sale where you might receive bulk discounts, e.g. Buy two get one free sales; Buy four get one free

  • Coupons are available to get money off the bill when the total amount is above a threshold, e.g. $5 off when you spend $100 or more

My answer: I am not sure how much is correct, or how I can improve it?!

  • Abstract factory

  • Builder

  • Decorator

I attached my design based on C#, and the C# code can be view on http://ift.tt/29P1Fa7, I appreciated if you could help me to improve it in terms of design pattern, and Object-Oriented programming, or if there is a mistake in it.

Click on it to open in bigger size. ProductSellSection ShoppingCart

Aucun commentaire:

Enregistrer un commentaire