Question: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Bank { class BankAccount { // Private variables for storing the account balance and

using System;
using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace Bank { class BankAccount { // Private variables for storing the account balance and interest rate // ... ///
///
///
///
///
///
///
///
Console.WriteLine(" Press enter to exit."); Console.ReadLine(); } } }
create a BankAccount class. This class will need to keep track of an account balance and interest rate, and provide methods for manipulating these fields and calculating interest. The BankAccount class will be used as an object, and as such will need to have non-static fields and methods. The account balance and interest rate will need to be private variables that can only be accessed or modified through public methods. Here are a list of methods that you need to implement for BankAccount. A class structure has been provided for you- you will just need to write code where the comments tell you to. BankAccount-The default constructor. This creates a new account with a balance of $0 and an interest rate of 2.8%. Bank Account(startingBalance)-This constructor creates a new account with a balance of startingBalance and an interest rate of 2.8%. BankAccount(startingBalance, interestRate) -This constructor creates a new account with a balance of SstartingBalance and an interest rate of interestRate%. Withdraw(amount) - If there is enough money in the account, this method subtracts amount from the current balance and returns true. If there isn't enough, this method leaves the balance untouched and instead returns false. Deposit(amount) - This method adds amount to the current balance. QueryBalance0 - This method returns the crrent balance of the account. SetInterestRate(interestRate) . This method sets the interest rate of the account to interestRate%. GetInterestRate0 . This method returns the current interest rate of the account. Ifthe interest rate is 2.8% this method should return 28. AddInterest -This method calculates interest based on the current balance and adds itthe balance. lfthe balance s S 0 and the interest ate 5% when this method is called. the new balance of the account should be $105 (5% of$100 is $ The provided Main() function should produce the following output if the interest is being calculated correctly: y current bank balance is 1050.00 ress enter to exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
