Question: In C# Please! - Adjust the Withdrawl method to include an optional parameter, called IsOutOfNetwork. This should be boolean, and have a default value of

In C# Please!

- Adjust the Withdrawl method to include an optional parameter, called IsOutOfNetwork. This should be boolean, and have a default value of false. If your customer is making a withdrawl that is out of network (meaning they used an ATM not operated by the app's bank), tack on and addtional $2.50 to be deducted from their balance.

- Create a PayMortgage method that takes a Customer object as a parameter and returns a modified customer object back. Use the MortgagePrincipal and MortgageInterest properties to calculate how much money is dedeucted from the MortgagePrincipal after a payment. BE SURE IT CAN HANDLE EDGE CASE SCENARIOS! Assign the MortgagePrincipal property the value of the resut, and then return the modified customer object. Formula: MortgagePrincipal = MortgagePrincipal - (MortgagePrincpal * intrest). Interest must be value between 0 and 1.

using Week3UnitTests.Data; using Week3UnitTests.Model;

namespace Week3UnitTests { public class UnitOfWork : IUnitOfWork { List _customers;

public UnitOfWork(List customers) { _customers = customers; }

public void Deposit(int customerId, decimal amount) { if (amount <= 0) throw new Exception("Amount value must be greater than zero");

Customer? customer = _customers.FirstOrDefault(x => x.Id == customerId);

if (customer is null) throw new Exception($"No customer with ID of {customerId}"); int custIdx = _customers.IndexOf(customer);

_customers[custIdx].CurrentBalance += amount; }

public void Withdrawal(int customerId, decimal amount) { if (amount >= 0) throw new Exception("Amount value must be greater than zero");

Customer? customer = _customers.FirstOrDefault(x => x.Id == customerId);

if (customer is null) throw new Exception($"No customer with ID of {customerId}");

int custIdx = _customers.IndexOf(customer);

_customers[custIdx].CurrentBalance += amount; }

public decimal GetBalance(int customerId) { Customer? customer = _customers.FirstOrDefault(x => x.Id == customerId);

if (customer is null) throw new Exception($"Could not locate customer with ID of {customerId}");

return customer.CurrentBalance; }

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!