Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with question 6 i have my code below but i don't think i have implement it correctly in my customerlist class code

I need help with question 6 i have my code below but i don't think i have implement it correctly in my customerlist class code image text in transcribed

using System; using System.Collections.Generic; using System.Text;

namespace CustomerMaintenance public class CustomerList { private List customers;

public delegate void changedhandler(customers); public event changedhandler changed;

public CustomerList() { customers = new List() }

public int Count => customers.Count;

public Customer this[int i]

public Customer this[string firstname] { get { foreach (Customer c in customers)

if (c.FirstName == firstname) return c; return null; }

} public void Fill() => customers = CustomerDB.GetCustomers();

public void Save() => CustomerDB.SaveCustomers(customers);

public void Add(Customer customer) { customers.Add(customer); changed(this); }

public void Add(string firstname, string lastname, string email) { Customer c = new Customer(firstname, lastname, email); frmCustomers.Add(c); changed(this); }

public void Remove(Customer customer) { => customers.Remove(customer) changed(this); }

public static CustomerList operator +()

}

Add a CustomerList class 5. Add a class named CustomerList to the project, and declare a private variable that can store a list of Customer objects. 6. Add the following members to the CustomerList class, coding Count as an expression-bodied property and Fill() and Save() as expression-bodied methods: Constructor Description () Creates a new list of Customer objects. Indexer Description [index] Provides access to the Customer at the specified position. Property Description Count An integer that indicates how many Customer objects are in the list. Method Description Add(customer) Adds the specified Customer object to the list. Remove (customer) Removes the specified Customer object from the list. F111() Fills the list with customer data from a file using the GetCustomers() method of the CustomerDB class. Save() Saves the customers to a file using the SaveCustomers() method of the CustomerDB class. 7. Modify the Customer Maintenance form to use this class. To do that, you'll need to use the Fill() and Save() methods of the CustomerList object instead of the methods of the CustomerDB class. In addition, you'll need to use a for loop instead of a foreach loop when you fill the list box. 8. Run the application and test it to be sure it works properly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago