Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

2. Define the grand narrative.

Answered: 1 week ago