Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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<CustomerGroup> customer = new List<CustomerGroup>();
- private List<CustomerGroup> customer;
- public CustomerGroup()
- {
- //Constructors
- groupID = 0;
- customerName = "";
- address = "";
- registerDate = DateTime.Now;
- totalTransactions = 200;
- accountExecutive = new Employee();
- List<Customer> unsortedCustomer = new List<Customer>();
- }
- public CustomerGroup (int newgroupID, string newCustomerName, string newAddress, DateTime newRegisterDate, int newTotalTransactions, Employee newaccountExecutive, List<Customer>newUnsortedCustomer)
- {
- 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<CustomerGroup> 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement