Answered step by step
Verified Expert Solution
Question
1 Approved Answer
An x store offers a special treatment for their regular and VIP customers which include discounting a defined percentage from their purchases' cost while the
An x store offers a special treatment for their regular and VIP customers which include discounting a defined percentage from their purchases' cost while the new customer does not have a similar offer. Also this store try to kee .a list for every day customers and the total income. Translating this scenario into classes form, will lead to the following UML: Customer -name- - purchasesCost-0; +Customer +Customer(name:String, purchasesCost:double) +getName():String +setName(name:String):void +getPurchasesCost ():double +set PurchasesCos (purchasesCost:double):void +toStringo:String A superclass extends VIP subclasses Regular -discountRate:final double=0.05 New -discountRate:final double-0.10 +VIPO +VIP(name:String, purchasesCost:double) +get PurchasesCost ():double +toString():String +Regular) +Regular(name:String, purchasesCost:double) +getPurchasesCost ():double +toStringO:String +New +New(name:String, purchasesCost:double) Override "getPurchases Cost" in VIP and Regular classes to get the cost after discount. Override "toString" in VIP and Regular classes to add the cost after discount to what already in the super class. Create Main Class and name it "Daily CoustomerReport". In the main class: Ask the user to enter number of the customers for the current day. Create an array of customer (declared type) Start to fill the array by asking the user about the customer name, Purchases' Cost and type (V,R,N) and apply the polymorphism concept to decide the type of customers: VIP, Regular,New (actual type). Print as in the sample output: customers' information Print total income for that day O Sample output: Enter number of customers for the current day: 3 ********************* ********** Enter customer's name: Omar Enter customer's purchases cost: 50 Enter customer's type (V for VIP, R for Regular, and N for New): R ************* Enter customer's name: Majed Enter customer's purchases cost: 500 Enter customer's type (V for VIP, R for Regular, and N for New): V ******* **** Enter customer's name: Mohammed Enter customer's purchases cost: 49 Enter customer's type (V for VIP, R for Regular, and N for New): n ************ ********* Customer name: Omar, his/her purchases' Cost: 50.0, cost after discount: 47.5 Customer name: Majed, his/her purchases' Cost: 500.0, cost after discount: 450.0 Customer name: Mohammed, his/her purchases' Cost: 40.0 ******** **** Current day income: 537.5 ********** ***** **************
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started