Question: Create a console application Customer Management with Classes and Delegate/Event 1. Customer Class Private variable firstName, lastName, email, id (you could use a phone number
Create a console application Customer Management with Classes and Delegate/Event
1. Customer Class
| Private variable | firstName, lastName, email, id (you could use a phone number as id) |
| Constructor Customer() Customer(firstName, lastName, email, id) | Create a new Customer Objects |
| Properties FirstName, LastName, Email, ID | Customer information |
| Method public string GetDisplayText() | Get the customer information (Name, Email, ID), and return a string. |
2. CustomerList Class Add the following members to the CustomerList class
| Private variable | private List |
| Constructor () | Create a new list of Customer Objects |
| Property (Read only) Count | An integer that indicates how many Customer Objects are in the list. |
| Indexer [index] | Provides access to the Customer at the specified position. public Customer this[int index]{...} |
| Method Add(customer) | Adds the specified customer object to the list |
| Remove(customer) | Removes the specified customer object from the list |
|
Delegate & Event
| public delegate void ChangeHandler(CustomerList customers); public event ChangeHandler ? Changed; The event Changed uses the ChangeHandler delegate and should be raised any time the customer list changes |
3. Main Program
Allow a user to choose from the following options, then guide the user through the add or delete functions. Make your application self-explanatory and user-friendly.
Option 1: Add a new customer Option 2: Delete a customer Option 3: Exit the program
Subscribe to the Changed event. Whenever there is a change in the CustomerList (add or delete), display on the console the entire list of the customers with name, email and ID information
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
