quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryبرمجة وتطوير البرمجيات schoolبكالوريوس event_available2026-07-13

السؤال

Transcribed Image Text:

5. (Bonus Question: 20 Points) The Discount System You are asked to write a discount system for a beauty saloon, which provides services and sells beauty products. It offers 3 types of memberships: Premium, Gold and Silver. Premium, gold and silver members receive a discount of 20%, 15%, and 10%, respectively, for all services provided. Customers without membership receive no discount. All members receives a flat 10% discount on products purchased (this might change in future). Your system shall consist of three classes: Customer, Discount and Visit, as shown in the class diagram in Fig.4. It shall compute the total bill if a customer purchases $x of products and $y of services, for a visit. Also write a test program to exercise all the classes. The class DiscountRate contains only static variables and methods (underlined in Fig.4). MovablePoint <<interface>> Movable +moveUp(): void +moveDown(): void +moveLeft():void +moveRight():void MovableCircle ~x:int ~y: int ~xSpeed:int ~ySpeed: int +MovablePoint(x:int,y:int, xSpeed: int,ySpeed: int) +toString(): String +moveUp(): void +moveDown(): void +moveLeft(): void +moveRight():void 1 -radius:int -center: MovablePoint +MovableCircle(x:int, y: int xSpeed: int,ySpeed: int, radius:int) +toString(): String +moveUp(): void +moveDown(): void +moveLeft(): void +moveRight():void Fig. 3: Interface Movable and its implementations -name: String Customer -member: boolean=false -memberType: String +Customer (name: String) +getName(): String +isMember(): boolean +setMember(member: boolean):void +getMemberType(): String +setMemberType (type: String): void +toString(): String 1 m Visit -customer: Customer -date: Date -serviceExpense:double -productExpense:double +Visit(name: String, date: Date) +getName(): String +getServiceExpense(): double +setServiceExpense (ex: double):void +getProductExpense(): double +setProductExpense (ex: double):void +getTotal Expense(): double +toString(): String DiscountRate -service DiscountPremium: double-0.2 -serviceDiscountGold: double-0.15 -service DiscountSilver: double-0.1 -productDiscountPremium: double-0.1 -productDiscountGold: double-0.1 -productDiscountSilver: double-0.1 +getServiceDiscount Rate (type: String):double +getProductDiscount Rate (type: String): double Fig. 4: Class diagram for the Discount System

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top