Designing Classes in C# for Customer Management System

Please use c# programming language. Design a class named Person with properties for holding a person’s name, address, and telephone number. Design a class named Customer, which is derived from the Person class. The Customer class should have the variables and properties for the customer number, customer email, a spentAmount of the customer’s purchases, and a Boolean variable indicating whether the customer wishes to be on a mailing list. It also includes a function named calcAmount that calculates the spentAmount. All retail store has a preferred customer plan where customers can earn discounts on all their purchases. The amount of a customer’s discount is determined by the amount of the customer’s cumulative purchases in the store as follows: When a preferred customer spends $500, he or she getsa 5% discount on all future purchases. When a preferred customer spends $1000, he or she getsa 6% discount on all future purchases. When a preferred customer spends $1500, he or she getsan 8% discount on all future purchases. When a preferred customer spends $2000, he or she getsa 10% discount on all future purchases. Design a class named PreferredCustomer, which is derived from the Customer class. The PreferredCustomer class should have a variable, discountLevel, with a read-only property. It alsoincludes a setDiscountLevel function that determine the discount level based on the purchases amount using switch statement and an override function, calcAmount, calculates the spentAmount with the current discount level. Create a CustomerDemo class. In the main function, the program calls the getData function to read the data from the “CustomerInfo.txt” file and create a dynamic array of PreferredCustomer object. Then, it prompts user to enter a customer number and displays a menu: DisplayCustomer Information: display the specific customer information Update SpentAmount: update the total amount with the correct discount level After update the spent Amount, the program writes the updated information back to file.  

Sample Answer

  Designing Classes in C# for Customer Management System In the modern era of retail business, effective customer management is crucial for the success of any store. To achieve this, we can create a robust system using object-oriented programming in C# to handle customer information and preferences efficiently. Let's delve into the design of classes for managing customers, preferred customers, and their discount levels. 1. Person Class public class Person { public string Name { get; set; } public string Address { get; set; } public string TelephoneNumber { get; set; } } 2. Customer Class (Derived from Person) public class Customer : Person { public int CustomerNumber { get; set; } public string CustomerEmail { get; set; } public double SpentAmount { get; set; } public bool WantsMailingList { get; set; } public void CalcAmount() { // Calculation logic for spent amount } } 3. PreferredCustomer Class (Derived from Customer) public class PreferredCustomer : Customer { public int DiscountLevel { get; private set; } public void SetDiscountLevel() { switch (SpentAmount) { case >= 2000: DiscountLevel = 10; break; case >= 1500: DiscountLevel = 8; break; case >= 1000: DiscountLevel = 6; break; case >= 500: DiscountLevel = 5; break; default: DiscountLevel = 0; break; } } public override void CalcAmount() { SetDiscountLevel(); // Calculation logic for spent amount with discount } } 4. CustomerDemo Class public class CustomerDemo { public static void Main() { // Code for reading data from "CustomerInfo.txt" file and creating PreferredCustomer objects // Prompt user for customer number input // Display menu options // Handle user interaction and update spent amount with correct discount level // Write updated information back to file } } By implementing these classes in C#, you can create a comprehensive customer management system that efficiently handles customer details, calculates spent amounts with discounts, and provides a seamless user experience for updating customer information. This structured approach not only enhances code maintainability but also improves the overall functionality of the system.