Hi this is my first time here on StackOverflow asking questions. Just started learning how to code. I am making a Ordering System with three objects Customer, Inventory and OrderForm.
I have to be able to add/save, Customer information (the below fiels) to a .csv file. via StreamWriter. Also be able to edit and delete and specific information anytime I want.
Now from what I have researched it seems Lists are the best way to go about holding the information till they have been written into the file, also they are much easier to edit and delete the information
I've declared a list (is that the proper way to do it?) in the customer class. How would I go about adding all those variables to the List now? Then be able able to edit or delete them as I want?
Appreciate the help.
public class Customer
{
//Holds Customer Info.
List<Customer> custInfo = new List<Customer>();****THIS ONE*******
//Instance Variables
private string custName;
private string custID;
private string custAddress;
private string custState;
private int custZip;
private int custAge;
private decimal totalOrdered;
public Customer()
{ }//default constructor
// retrieve the customer name
public string getCustomerName()
{
return custName;
}//end of getCustomerName method
// set the customer name
public void setCustomerName(string customerName)
{
custName = customerName;
}//end of setCustomerName method
//get customerID
public string getCustID()
{
return custID;
}//end of getCustID
//set CustomerID
public void setCustID(string customerID)
{
custID = customerID;
}//end setCustID
// retrieve the customer address
public string getCustomerAddress()
{
return custAddress;
}//end of getCustomerAddress method
// set the customer address
public void setCustomerAddress(string customerAddress)
{
custAddress = customerAddress;
}//end of setCustomerAddress method
//retrieves customer state
public string getCustState()
{
return custState;
}//end getCustState
//sets customer state
public void setCustState(string customerState)
{
custState = customerState;
}//end setCustState
// retrieve the customer zip
public int getCustomerZip()
{
return custZip;
}//end of getCustomerZip method
// set the customer Zip
public void setCustomerZip(int customerZip)
{
custZip = customerZip;
}//end of setCustomerZip method
//Gets customer age
public int getCustomerAge()
{
return custAge;
}//end getCustomerAge
//sets customer age
public void setCustomerAge(int customerAge)
{
custAge = customerAge;
}//end setCustomerAge
//gets customers total order
public decimal getTotalOrdered()
{
return totalOrdered;
}//end getTotalOrdered
//sets total ordered
public void setTotalOrdered(decimal customerTotal)
{
totalOrdered = customerTotal;
}//end setTotalOrdered
}//end public class Customer