using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace programName { public class CustomerGroup { //Members private int groupID; private string customerName; private string address; private DateTime registerDate; private int totalTransactions; private Employee accountExecutive = new Employee(); private List customer = new List(); private List customer; public CustomerGroup() { //Constructors groupID = 0; customerName = ""; address = ""; registerDate = DateTime.Now; totalTransactions = 200; accountExecutive = new Employee(); List unsortedCustomer = new List(); } public CustomerGroup (int newgroupID, string newCustomerName, string newAddress, DateTime newRegisterDate, int newTotalTransactions, Employee newaccountExecutive, ListnewUnsortedCustomer) { groupID = newgroupID; customerName = newCustomerName; address = newAddress; registerDate = newRegisterDate; totalTransactions = newTotalTransactions; accountExecutive = newaccountExecutive; unsortedCustomer=newUnsortedCustomer; } public int groupID { get { return groupID; } set { groupID = value; } } public string customerName { get { return customerName; } set { customerName = value; } } public string address { get { return address; } set { address = value; } } public DateTime registerDate { get { return registerDate; } set { registerDate = value; } } public int totalTransactions { get { return totalTransactions; } set { totalTransactions = value; } } public Employee accountExecutive { get { return accountExecutive; } set { accountExecutive = value; } } public List customer { get { return customer; } set { customer = value; } } //Work Methods //logic for determining discounts public int CalcRegisterDate() { //Get current date DateTime currDate = DateTime.Now; //Get difference in months int months = currDate.Month - addDate.Month; //Get average transactions per month int avgTransactions = 0; if (months > 0) //If statement insures it doesn't divide by 0 avgTransactions = totalTransactions / months; //Calculate discount int low = 6; int high = 15; int discount = 0; if (avgTransactions > low) //If has an average of 8 or more transactions per month, awarded 5% discount discount = 5; if (avgTransactions > high) //If has a an average of 15 or more transactions per month, awarded 10% discount discount = 10; return discount; public int GetRegisterDate() { // Get today's date DateTime currDate = DateTime.Now; // Get the difference in years int years = currDate.Year - startDate.Year; // Subtract another year if we're before the // start date in the current year if (currDate.Month < startDate.Month || (currDate.Month == startDate.Month && currDate.Day < startDate.Day)) years--; return years; } }