Vous êtes sur la page 1sur 4

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace CustomerAccountProj { class Program { static void Main(string[] args) { CustomerMgr mgr = new CustomerMgr(); Customer c1 = new Customer("C001", "Ramesh"); Account acc1 = new Account("ACC01", "SAVINGS", 20000); c1.Setaccount(acc1); Customer c2 = new Customer("C002", "Sunita"); Account acc2 = new Account("ACC02", "CURRENT", 30000); c2.Setaccount(acc2); Customer c3 = new Customer("C003", "Vinay"); Account acc3 = new Account("ACC03", "Recuuring Deposit", 40000); c3.Setaccount(acc3); mgr.AddCustomer(c1); mgr.AddCustomer(c2); mgr.AddCustomer(c3); mgr.GenerateCustomerReport(); mgr.GenereateComprehensiveCustomerReport();

} } }

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace CustomerAccountProj { class Account { string accNum; string accountType; double balance;

public Account(string aN, string aT, double bal) { accNum = aN; accountType = aT; balance = bal; } public void SetaccNum(string Num) { accNum = Num; } public string GetaccNum() { return accNum; } public void SetaccountType(string Type) { accountType = Type; } public string GetaccountType() { return accountType; } public void Setbalance(double _bal) { balance=_bal; } public double Getbalance() { return balance; }

} }

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace CustomerAccountProj { class Customer { string customerId; string customerName; Account account; public Customer(string id, string name) {

customerId = id; customerName = name; } public void SetcustomerId(string _custId) { customerId = _custId; } public string GetCustomerID() { return customerId; } public void SetcustomerName(string _Name) { customerName = _Name; } public string GetcustomerName() { return customerName; } public void Setaccount(Account acc) { account = acc; } public Account Getaccount() { return account; }

} }

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace CustomerAccountProj { class CustomerMgr { Customer[] customers = new Customer[100]; int numOfCustomers; public void AddCustomer(Customer c) { customers[numOfCustomers] = c; numOfCustomers++; }

public void GenerateCustomerReport() { for (int i = 0; i < numOfCustomers; i++) { Customer c = customers[i]; Console.WriteLine("Customer ID" + c.GetCustomerID()); Console.WriteLine("Customer Name " + c.GetcustomerName());

} public void GenereateComprehensiveCustomerReport() { for (int i = 0; i < numOfCustomers; i++) { Customer c = customers[i]; Console.WriteLine("Customer ID" + c.GetCustomerID()); Console.WriteLine("Customer Name " + c.GetcustomerName()); Console.WriteLine("Customer Account Number" + c.Getaccount().Ge taccNum()); Console.WriteLine("Customer Account Type" + c.Getaccount().Getac countType()); Console.WriteLine("Customer Account Balance" + c.Getaccount().Ge tbalance()); } }

} }

Vous aimerez peut-être aussi