Question: static void Main() { const int MaxCustomers = 3; // You can change this to the desired number of customers PreferredCustomer[,] customers = new [MaxCustomers,

static void Main() { const int MaxCustomers = 3; // You can change this to the desired number of customers

PreferredCustomer[,] customers = new [MaxCustomers, 1];

for (int i = 0; i < MaxCustomers ??) { Console.WriteLine($"Enter information for Customer {i + 1}:");

customers[i, 0] = new PreferredCustomer();

Console.Write("Enter customer's name: "); customers[i, 0].Name = Console.ReadLine();

Console.Write("Enter customer's address: "); customers[i, 0].Address = Console.ReadLine();

Console.Write("Enter customer's telephone number: "); customers[i, 0].TelephoneNumber = Console.ReadLine();

Console.Write("Enter customer number: "); customers[i, 0].CustomerNumber = int.Parse(Console.ReadLine());

Console.Write("Enter before-discount purchase total: "); customers[i, 0].BeforeDiscountPurchaseTotal = double.Parse(Console.ReadLine());

Console.Write("Does the customer want to be on the mailing list? (true/false): "); customers[i, 0].IsOnMailingList = bool.Parse(Console.ReadLine());

Calculate and display discount customers[i, 0].CalculateDiscount(); Console.WriteLine($"Discount Percentage: {customers[i, 0].DiscountPercentage}%"); ??CREATE THE ENTIRE LINE TO OUTPUT THE AFTER-DISCOUNT PURCHASE TOTAL SEE SCREENSHOTS FOR EXAMPLE }

Search for a customer by CustomerNumber Console.Write("Enter CustomerNumber to search for: "); int searchCustomerNumber = int.Parse(Console.ReadLine());

/referredCustomer ?? = SearchCustomer(customers, searchCustomerNumber);

?? (foundCustomer != null) { Console.WriteLine($"Customer found: Name: {foundCustomer.Name} Address: {foundCustomer.Address} Telephone: {foundCustomer.TelephoneNumber}"); } else { Console.WriteLine("Customer not found."); } }

static PreferredCustomer SearchCustomer(PreferredCustomer[,] customers, int customerNumber) { ?? (int i = 0; i < customers.GetLength(0); i++) { if (customers[i, 0].CustomerNumber == customerNumber) { return customers[i, 0]; } }

?? null; // Customer not found

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!