You have been contracted to create an application that can be used to determine the discount awarded for preferred customers. Because of the time limitation, you should focus your attention on the preferred customer class. Include data members of customer ID, customer name, and customer purchase. Define appropriate constructors and properties for the class.
Include a method that returns the discount percentage based on the following:
• When a preferred customer spends a minimum of $500, he or she gets a 5 percent discount
• When a preferred customer spends a minimum of $1,000, his discount is 6 percent
• When a preferred customer spends a minimum of $1,500, his discount is 7 percent discount
• When a preferred customer spends at least $2,000, he or she gets a 10 percent discount
Include an additional instance method that returns the actual reduced discounted price. Override the ToString( ) method to return the customer name, his purchase amount (formatted as currency), discount percentage (if any),and the reduced purchase price (formatted as currency).
Define the 2nd class to test your preferred customer class. You may instantiate your objects with literal data sent as arguments to the constructors. You do not have to input the data. USE YOUR OWN NAME AS THE CUSTOMER NAME FOR ONE OF THE OBJECTS THAT YOU INSTANTIATE. Before instantiating an object of the class, check to make sure the purchase amount entered is a positive integer. If the value entered for the purchase amount is negative, display an error message indicating the input is in-valid. Modularize your solution.
Sample output might look like:
Customer: Barbara Doyle
Purchase Amt. $1,423.78
Discount Percent: 6%
Discounted Amt.: $1,338.36
Customer: Sarah Wang
Purchase Amt. $401.28
Discount Percent: 0%
Discounted Amt.: $401.28
Write a Review
Leave a reply Cancel reply
Ask Your Question
We have verified professionals who are ready to answer your question.
Save Time and Money
We choose experts who can quickly answer your question and that suit your budget.
Get Your Answer
Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.