Define a class SavingsAccount with following characteristics.
Input
4
2000.00
5
Where,
Output
2666.6667
3777.7778
Where,
#include <iostream>
using namespace std;
int main()
{
//Write your code here
}
#include <iostream>
using namespace std;
class SavingsAccount
{
private:
float savingsBalance;
public:
static float annualInterestRate;
// default constructor sets balance=0
SavingsAccount(){
savingsBalance = 0;
}
// parameterize constructor to set values
SavingsAccount(int newVal){
savingsBalance = newVal;
}
// accessor function of saving balance
float getSavingBalance() {
return savingsBalance;
}
// mutator function of saving balance
void setSavingBalance(float newVal) {
this->savingsBalance =
newVal;
}
// this function calculates monthly interest by using formula
(savingsBalance * annualInterestRate / 12)
void calculateMonthlyInterest (){
savingsBalance = savingsBalance +
((savingsBalance * annualInterestRate ) / 12);
}
// this function sets new interest rate
void modifyInterestRate (float newVal){
annualInterestRate = newVal;
}
};
float SavingsAccount::annualInterestRate = 0; //intializing static
varaible equal to
int main()
{
float savingsBalance;
float annualInterest;
float modifiedIntrest;
cout << "Enter saving balance: ";
cin >> savingsBalance;
cout << "Enter annual interest: ";
cin >> annualInterest;
// object decalred wiht parameterized
constructor
SavingsAccount obj(savingsBalance);
// annual interest set
obj.modifyInterestRate (annualInterest);
obj.calculateMonthlyInterest();
cout << "Enter modified annual interest:
";
cin >> modifiedIntrest;
cout << "Savings Balance: " <<
obj.getSavingBalance() << endl;
obj.modifyInterestRate(modifiedIntrest);
obj.calculateMonthlyInterest();
cout << "Savings Balance: $" <<
obj.getSavingBalance() << endl;
return 0;
}
OUTPUT:
CODE SNIP:
IF YOU HAVE ANY QUERY PLEASE COMMENT DOWN BELOW
PLEASE GIVE A THUMBS UP
Define a class SavingsAccount with following characteristics. Use a static variable annualInterestRate of type float to...
Create a .java file that has class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide method calculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12- this interest should be added to savingsBalance. Provide a static method setInterestRate that sets the annualInterestRate to a new value....
Code should be in C# Create a class called SavingsAccount. Use a static variable called annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12 – this interest should be added to savingsBalance. Provide static method setAnnualInterestRate to set the annualInterestRate to a new value....
Application should be in C# programming language Create a class called SavingsAccount. Use a static variable called annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12 – this interest should be added to savingsBalance. Provide static method setAnnualInterestRate to set the...
Create the class savings account. Use the static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the classcontains a private instance variable savingsBalance, indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate themonthly interest by multiplying the savingsBalance by annualInterestRate divided by 12, this interest should be added to savingsBlance, Provide static methodModifyInterestRate to set the annualInterestRate to a new value. Write an application to test class SavingsAccount....
Using C++ Please make sure you comment each section of the program so I can better understand it. Thank you! Assignment Content You are now working for a bank, and one of your first projects consists of developing an application to manage savings accounts. Create a C++ program that does the following: Creates a SavingsAccount class Uses a static data member, annualInterestRate, to store the annual interest rate for each of the savers Ensures each member of the class contains...
/*Design a class BankAccount that has the following properties: * Account Number (should be static and increased every time an account is created. * An array of holders max 5 and a holder is a Person object * A int to rember how many holders * Balance (float) * Date opened * interest rate * Constructors * addHolder will add one more Person as a holder, if you reach 5 don't add. * Setters getters * method payInterest that add...
TASK 1 Create a new class called CheckingAccount that extends BankAccount. It should contain a static constant FEE that represents the cost of clearing onecheck. Set it equal to 15 cents. Write a constructor that takes a name and an initial amount as parameters. Itshould call the constructor for the superclass. It should initializeaccountNumber to be the current value in accountNumber concatenatedwith -10 (All checking accounts at this bank are identified by the extension -10). There can be only one...
C++ Help. PLEASE include detailed comments and explanations. PLEASE follow the drections exactly. Thank you. Define a class with the name BankAccount and the following members: Data Members: accountBalance: balance held in the account interestRate: annual interest rate. accountID: unique 3 digit account number assigned to each BankAccount object. Use a static data member to generate this unique account number for each BankAccount count: A static data member to track the count of the number of BankAccount objects created. Member...
Design and implement the following 3 classes with the exact fields and methods (these names and caps exactly): 1. An abstract class named BankAccount (java file called BankAccount.java) Description Filed/Method Balance NumberDeposits NumberWithdrawals AnnualInterestRate MonthlyServiceCharge BankAccount SetHonthlyServiceCharges A method that accepts the monthly service charges as an argument and set the field value GetBalance GetNum berDeposits GetNum berWithdrawals GetAnnualinterestRate GetMonthlyServiceCharge A method that returns the monthly service charge Deposit field for the bank account balance A field for the number...
In Java: DATA TYPE CLASS Create one data type class Account_yourLastName that hold the information of an account such as accountNumber (String), name (String), address (String), balance (float), interestRate(float) and beside the no-argument constructor, parameterized constructor, the class has method openNewAccount, method checkCurrentBalance, method deposit, method withdrawal, method changeInterestRate REQUIREMENT - DRIVER CLASS Provide the application for the Bank Service that first displays the following menu to allow users to select one task to work on. After finishing one task,...