In C# thanks please, Design a class named Person with properties for holding a person’s name, address,...

50.1K

Verified Solution

Question

Programming

In C# thanks please,

Design a class named Person with properties for holding aperson’s name, address, and telephone number.

Design a class named Customer, which is derived from the Personclass. The Customer class should have the variables and propertiesfor the customer number, customer email, a spentAmount of thecustomer’s purchases, and a Boolean variable indicating whether thecustomer wishes to be on a mailing list. It also includes afunction named calcAmount that calculates the spentAmount.

All retail store has a preferred customer plan where customerscan earn discounts on all their purchases. The amount of acustomer’s discount is determined by the amount of the customer’scumulative purchases in the store as follows:

  • When a preferred customer spends $500, he or she gets a 5%discount on all future purchases.
  • When a preferred customer spends $1000, he or she gets a 6%discount on all future purchases.
  • When a preferred customer spends $1500, he or she gets an 8%discount on all future purchases.
  • When a preferred customer spends $2000, he or she gets a 10%discount on all future purchases.

Design a class named PreferredCustomer, which is derived fromthe Customer class. The PreferredCustomer class should have avariable, discountLevel, with a read-only property. It alsoincludesa setDiscountLevel function that determine the discount level basedon the purchases amount using switch statement and an overridefunction, calcAmount, calculates the spentAmount with the currentdiscount level.

Create a CustomerDemo class. In the main function, the programcalls the getData function to read the data from the“CustomerInfo.txt” file and create a dynamic array ofPreferredCustomer object.  Then, it prompts user to entera customer number and displays a menu:

  1. Display Customer Information: display the specific customerinformation
  2. Update Spent Amount: update the total amount with the correctdiscount level

After update the spent Amount, the program writes the updatedinformation back to file.

Example for customer info.txt below (there are 5 persons)

Kyle Jones

879 hobbs st. boston,MA 84758

456-789-0001

JLA9876A

[email protected]

3000

true

.

.

.

.

Answer & Explanation Solved by verified expert
4.3 Ratings (735 Votes)
SOLUTION I have solve the problem in C code with comments andscreenshot for easy understanding ScreenshotProgramusing Systemusing SystemIOnamespace CustomerDemo MAin Program class Program static voidMainstring args Array to store customersPrefferedCostumer pc new PrefferedCostumer pcgetDataLoop until exitwhile trueEach optionConsoleWriteLineOPTIONSn1 Display Cutomer Informationn2Update Spend Amountn3 Exitint opt ConvertToInt32ConsoleReadLineErrorEventArgs checkwhileopt 3ConsoleWriteLinenIncorrect optionnConsoleWriteLinenOPTIONSn1 Display Cutomer Informationn2Update Spend Amountn3 Exitopt ConvertToInt32ConsoleReadLineExecute optionsif opt 1bool check falseGet customer numberConsoleWriteLinenEnter customer number string number ConsoleReadLineIf match display detailsforint i 0 i pcLength iif pciGetNumberCompareTonumber 0ConsoleWriteLinepcicheck truebreakif check falseConsoleWriteLinenNot foundnelse if opt 2bool check falseGet customer numberConsoleWriteLinenEnter customer number string number ConsoleReadLineIf match get cutomer spend amout and write into    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students