public override void Withdraw(double amount, Enums.TransactionType transactionType) { //check to see if there are available funds if (amount <= this.Balance) { base.Withdraw(amount, transactionType); //penalty charge for REGULAR customer if (this.Owner.Status == Enums.CustomerStatus.REGULAR) { base.Withdraw(WithdrawPenaltyAmount, Enums.TransactionType.PENALTY); //change Customer Status if (this.Balance < PremierAmount) { this.Owner.Status = Enums.CustomerStatus.REGULAR; } else { this.Owner.Status = Enums.CustomerStatus.PREMIER; } } } else { throw new Exception("Withdrawal cancelled: INSUFFICIENT_FUNDS"); } }
//public virtual double Deposit(double amount) public virtual void Deposit(double amount, Enums.TransactionType transactionType) { this.Balance += Math.Round(amount, 2); Transaction newTransaction = new Transaction(amount, transactionType); this.TransactionHistory.Add(newTransaction); }
public void addTransaction(Enums.TransactionType transactionType, DateTime date, double amount) { String format = "MM/dd/yy"; this.activity.Add(transactionType); this.date.Add(date.ToString(format)); this.amount.Add(amount); }
internal void doTransaction(Enums.TransactionType dEPOSIT) { switch (dEPOSIT) { case Enums.TransactionType.DEPOSIT: int x1 = selectAccount(); Console.Write("Enter Amount:"); int dAmount1 = int.Parse(Console.ReadLine()); if (x1 == 1) { checking.deposit(dAmount1); } else if (x1 == 2) { savings.deposit(dAmount1); } break; case Enums.TransactionType.WITHDRAW: int x2 = selectAccount(); Console.Write("Enter Amount:"); int dAmount2 = int.Parse(Console.ReadLine()); if (x2 == 1) { checking.withraw(dAmount2); } else if (x2 == 2) { savings.withraw(dAmount2); } break; case Enums.TransactionType.TRANSFER: Console.Write("1 - From Checking to Saving, 2 - From Saving to Checking):"); int x3 = int.Parse(Console.ReadLine()); Console.Write("Enter Amount:"); int dAmount3 = int.Parse(Console.ReadLine()); if (x3 == 1) { checking.transferOUT(dAmount3, savings); } else if (x3 == 2) { savings.transferOUT(dAmount3, checking); } break; case Enums.TransactionType.IN: Console.Write("Current Balance:"); Console.WriteLine(" Amount Balance"); Console.WriteLine(" ------ --------"); Console.WriteLine(" " + "checking" + " " + checking.initialBalance); Console.WriteLine(" " + "saving" + " " + savings.initialBalance); break; } }
public override void Deposit(double amount, Enums.TransactionType transactionType) { base.Deposit(amount, transactionType); //change Customer Status if (this.Balance >= SavingsAccount.PremierAmount) { this.Owner.Status = Enums.CustomerStatus.PREMIER; } }
//public void Withdraw(double amount) public virtual void Withdraw(double amount, Enums.TransactionType transactionType) { //check if there is money in the account if (this.Balance >= amount) { this.Balance -= Math.Round(amount, 2); Transaction newTransaction = new Transaction(amount, transactionType); this.TransactionHistory.Add(newTransaction); } }
public override void Withdraw(double amount, Enums.TransactionType transactionType) { //check to see if there are available funds if (amount <= this.Balance) { //if (Owner.Status == Enums.CustomerStatus.REGULAR && amount > MaxWithdrawAmount) if (Owner.Status == Enums.CustomerStatus.REGULAR && amount > MaxWithdrawAmount) { throw new Exception("Withdrawal cancelled: Exceeds maximum withdrawal limit of $300 for Customers having REGULAR Status."); } else { //either Premier Account OR less than MaxWithdrawAmount base.Withdraw(amount, transactionType); } } else { throw new Exception("Withdrawal cancelled: INSUFFICIENT_FUNDS"); } }
public override void Deposit(double amount, Enums.TransactionType transactionType) { base.Deposit(amount, transactionType); }
public Transaction(double x, Enums.TransactionType y) { Amount = x; Type = y; TransactionDate = DateTime.Now; }
//Constructor public Transaction(double amount, Enums.TransactionType transactionType) { this.Amount = amount; this.Type = transactionType; this.TransactionDate = DateTime.Now; }