public DollarAmount TransferTo(BankAccount destination, DollarAmount amountToTransfer) { this.Withdraw(amountToTransfer); destination.Deposit(amountToTransfer); return(balance); }
public void Transfer(BankAccount destinationAccount, DollarAmount transferAmount) { //int amountInCentsToTransfer = convertBalanceToCents(transferAmount.Dollars, transferAmount.Cents); DollarAmount x = this.Withdraw(transferAmount); destinationAccount.Deposit(x); }
public virtual DollarAmount Withdraw(DollarAmount amountToWithdraw) { int balanceToCents = convertBalanceToCents(balance.Dollars, balance.Cents) - convertBalanceToCents(amountToWithdraw.Dollars, amountToWithdraw.Cents); balance = new DollarAmount(balanceToCents); return(balance); }
public DollarAmount Deposit(DollarAmount amountToDeposit) { int balanceToCents = convertBalanceToCents(balance.Dollars, balance.Cents) + convertBalanceToCents(amountToDeposit.Dollars, amountToDeposit.Cents); balance = new DollarAmount(balanceToCents / 100, balanceToCents % 100); return(balance); }
public DollarAmount Deposit(DollarAmount amountToDeposit) { int existingAmount = (balance.Dollars * 100) + balance.Cents; int depositAmount = (amountToDeposit.Dollars * 100) + amountToDeposit.Cents; int newAmount = existingAmount + depositAmount; balance = new DollarAmount(newAmount); return(balance); }
public virtual DollarAmount Withdraw(DollarAmount amountToWithdraw) { int existingAmount = (balance.Dollars * 100) + balance.Cents; int withdrawAmount = (amountToWithdraw.Dollars * 100) + amountToWithdraw.Cents; int newAmount = existingAmount - withdrawAmount; balance = new DollarAmount(newAmount); return(balance); }
public void AddAccount(BankAccount newAccount) { List <BankAccount> _bankAccountList = accounts.ToList(); _bankAccountList.Add(newAccount); accounts = _bankAccountList.ToArray(); totalCustBalance = totalCustBalance.Plus(newAccount.Balance); if (totalCustBalance.totalAmountInCents >= 2500000) { isVip = true; } }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { // only perform transaction of positive $ if (!Balance.Minus(amountToWithdraw).IsNegative) { base.Withdraw(amountToWithdraw); // Assess $2 fee if it goes below $150 if (Balance.Dollars < 150) { base.Withdraw(new DollarAmount(200)); } } return(Balance); }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { DollarAmount withdrawFee = new DollarAmount(1000); DollarAmount totalWithdraw = withdrawFee.Plus(amountToWithdraw); if (Balance.Minus(amountToWithdraw).totalAmountInCents > 0) { balance = balance.Minus(amountToWithdraw); } else if (Balance.Minus(totalWithdraw).totalAmountInCents > -10000) { balance = balance.Minus(totalWithdraw); } return(Balance); }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { // Only allow the withdraw if the balance isn't going to go below -$100 if (Balance.Minus(amountToWithdraw).Dollars > -100) { // Withdraw the $$ base.Withdraw(amountToWithdraw); // If the balance dips below 0, assess $10 charge if (Balance.IsNegative) { base.Withdraw(new DollarAmount(10, 00)); } } return(Balance); }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { DollarAmount overdraftFeeAmount = new DollarAmount(1000); DollarAmount futureAmount = this.balance.Minus(amountToWithdraw); if (futureAmount.IsNegative && futureAmount.Dollars < -100) { return(this.balance); } else if (futureAmount.IsNegative) { this.balance = this.balance.Minus(overdraftFeeAmount); this.balance = this.balance.Minus(amountToWithdraw); return(this.balance); } return(base.Withdraw(amountToWithdraw)); }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { DollarAmount Threshold = new DollarAmount(15000); DollarAmount ServiceFee = new DollarAmount(200); DollarAmount futureAmount = this.balance.Minus(amountToWithdraw); if ((futureAmount.Dollars < Threshold.Dollars) && !futureAmount.IsNegative) { this.balance = this.balance.Minus(amountToWithdraw); this.balance = this.balance.Minus(ServiceFee); return(this.balance); } else if (futureAmount.IsNegative) { return(this.balance); } return(base.Withdraw(amountToWithdraw)); }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { int existingAmount = (Balance.Dollars * 100) + Balance.Cents; int withdrawAmount = (amountToWithdraw.Dollars * 100) + amountToWithdraw.Cents; int newAmount = existingAmount - withdrawAmount; if (newAmount < 0) { newAmount -= 1000; if (newAmount < -10000) { return(Balance); } } DollarAmount afterWithdraw = new DollarAmount(newAmount); return(afterWithdraw); }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { int existingAmount = (Balance.Dollars * 100) + Balance.Cents; int withdrawAmount = (amountToWithdraw.Dollars * 100) + amountToWithdraw.Cents; if (withdrawAmount > existingAmount) { return(Balance); } else if (existingAmount < 15000) { withdrawAmount += 200; } int newAmount = existingAmount - withdrawAmount; DollarAmount lowerBalance = new DollarAmount(newAmount); return(lowerBalance); }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { DollarAmount serviceCharge = new DollarAmount(200); DollarAmount totalWithdraw = serviceCharge.Plus(amountToWithdraw); if ((Balance.totalAmountInCents >= 15000) && (Balance.totalAmountInCents > amountToWithdraw.totalAmountInCents)) { balance = balance.Minus(amountToWithdraw); } else if ((Balance.totalAmountInCents < 15000) && (Balance.totalAmountInCents > amountToWithdraw.totalAmountInCents)) { balance = balance.Minus(totalWithdraw); } return(Balance); }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { int balanceToCents = convertBalanceToCents(Balance.Dollars, Balance.Cents) - convertBalanceToCents(amountToWithdraw.Dollars, amountToWithdraw.Cents); if (balanceToCents < 0 && balanceToCents > -10000) { this.balance = new DollarAmount(balanceToCents - 1000); return(balance); } else if (balanceToCents < -10000) { return(balance); } { this.balance = balance.Minus(new DollarAmount(balanceToCents)); return(balance); } }
public override DollarAmount Withdraw(DollarAmount amountToWithdraw) { int balanceToCents = convertBalanceToCents(Balance.Dollars, Balance.Cents) - convertBalanceToCents(amountToWithdraw.Dollars, amountToWithdraw.Cents); if (balanceToCents > 0 && convertBalanceToCents(Balance.Dollars, Balance.Cents) < 15000) { this.balance = new DollarAmount(balanceToCents - 200); return(balance); } else if (balanceToCents <= 0) { return(balance); } else { balance = new DollarAmount(balanceToCents); return(balance); } }
public override DollarAmount Withdraw(DollarAmount withdrawAmount) { if (withdrawAmount.ToDecimal() > Balance.ToDecimal()) { DollarAmount overdraftFee = new DollarAmount(1000); withdrawAmount = withdrawAmount.Plus(overdraftFee); if ((Balance.ToDecimal() - withdrawAmount.ToDecimal()) < -100) { return(Balance); } else { DollarAmount newBalance = base.Withdraw(withdrawAmount); return(newBalance); } } else { DollarAmount newBalance = base.Withdraw(withdrawAmount); return(newBalance); } }
public override DollarAmount Withdraw(DollarAmount withdrawAmount) { if (Balance.ToDecimal() < 150.00M) { DollarAmount processingFee = new DollarAmount(200); withdrawAmount = withdrawAmount.Plus(processingFee); if ((Balance.ToDecimal() - withdrawAmount.ToDecimal()) < 0) { return(Balance); } else { DollarAmount newBalance = base.Withdraw(withdrawAmount); return(newBalance); } } else { DollarAmount newBalance = base.Withdraw(withdrawAmount); return(newBalance); } }
public virtual DollarAmount Withdraw(DollarAmount amountToWithdraw) { this.balance = this.balance.Minus(amountToWithdraw); return(this.balance); }
//methods public DollarAmount Deposit(DollarAmount amountToDeposit) { this.balance = this.balance.Plus(amountToDeposit); return(this.balance); }
//constructor public BankAccount() { this.balance = new DollarAmount(0); }
/// <summary> /// Adds one dollar amound to another dollar amount /// </summary> /// <param name="amountToAdd"></param> /// <returns>New Dollar Amount Value</returns> public DollarAmount Plus(DollarAmount amountToAdd) { int newTotal = this.totalAmountInCents + amountToAdd.totalAmountInCents; return(new DollarAmount(newTotal)); }
/// <summary> /// Subtract one dollar amount from another dollar amount /// </summary> /// <param name="amountToSubtract"></param> /// <returns>New Dollar Amount Value</returns> public DollarAmount Minus(DollarAmount amountToSubtract) { int difference = this.totalAmountInCents - amountToSubtract.totalAmountInCents; return(new DollarAmount(difference)); }
public BankAccount(string accountHolder, string accountNumber, DollarAmount balance) { this.accountHolderName = accountHolder; this.accountNumber = accountNumber; this.balance = balance; }
// Constructor public BankAccount(string accountHolder, string accountNumber) { this.accountHolderName = accountHolder; this.accountNumber = accountNumber; this.balance = new DollarAmount(0); }
public void Transfer(BankAccount destinationAccount, DollarAmount transferAmount) { this.Withdraw(transferAmount); destinationAccount.Deposit(transferAmount); }
public void Transfer(BankAccount destinationAccount, DollarAmount transferAmount) { destinationAccount.Deposit(transferAmount); }
public SavingsAccount(string accountHolder, string accountNumber, DollarAmount balance) : base(accountHolder, accountNumber, balance) { }
// Update the balance by using the DollarAmount.Plus method public DollarAmount Deposit(DollarAmount amountToDeposit) { balance = balance.Plus(amountToDeposit); return(balance); }