1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
liubo4ka [24]
3 years ago
10

Create a SavingsAccount class. Use a static data member annualInterestRate to store the annual interest rate for each of the sav

ers. Each member of the class contains a private data member savingsBalance indicating the amount the saver currently has on deposit. Provide member function calculateMonthlyInterest that calculates the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12; this interest should be added to savingsBalance. Provide a static member function modifyInterestRate that sets the static annualInterestRate to a new value. Write a main program to test your class. Your program should prompt the user to enter the savingsBalance for two different accounts. It should ask for the annualInterestRate.
Computers and Technology
1 answer:
andrew-mc [135]3 years ago
4 0

Answer:

see explaination

Explanation:

SavingsAccount.h

#pragma once

#ifndef SAVINGS_H

#define SAVINGS_H

//SavingsAccount class declaration

class SavingsAccount

{

//declare data members

private:

//set annualInterestRate to 0.0 default value

static double annualInterestRate;

double savingsBalance;

public:

//set the balance

void setBalance(double);

//modify interest rates

static void modifyInterestRate(double);

//retruns total balance with interest

double calculateMonthInt();

};

#endif

SavingsAccount.cpp

//include required header files

#include<iostream>

#include"SavingsAccount.h"

using namespace std;

//set the annualInterestRate to 0

double SavingsAccount::annualInterestRate = 0;

//static funtion modify interest rate

void SavingsAccount::modifyInterestRate(double iRate)

{

annualInterestRate = iRate;

}

//set the balance

void SavingsAccount::setBalance(double bal)

{

savingsBalance = bal;

}

//calculating savings balance with monthly interest

double SavingsAccount::calculateMonthInt()

{

double monthInt = 0;

monthInt += savingsBalance*annualInterestRate / 12;

return savingsBalance += monthInt;

}

DriverProgram.cpp

//include required header files

#include<iostream>

#include "SavingsAccount.h"

using namespace std;

//main methods

int main()

{

//delcare class objects

SavingsAccount saver1, saver2;

//setter functions of balance

saver1.setBalance(2000.00);

saver2.setBalance(3000.00);

//Setting annual interset 0.03 to static variable

saver1.modifyInterestRate(0.03);

//finding the balance in saver1 and saver2 account

cout << "Balance of saver1 and saver2 on 3% interest Rate\n";

cout << "--------------------------------------------------\n";

cout << "Balance of saver1 = " << saver1.calculateMonthInt()

<< endl;

cout << "Balance of saver2 = " << saver2.calculateMonthInt()

<< endl << endl;

//Setting annual interset 0.04 to static variable

saver1.modifyInterestRate(0.04);

cout << "Balance of saver1 and saver2 on 4% interest Rate\n";

cout << "---------------------------------------------------\n";

cout << "New Balance of saver1 = " << saver1.calculateMonthInt() << endl;

cout << "New Balance of saver2 = " << saver2.calculateMonthInt() << endl<<endl;

return 0;

}

You might be interested in
Which method of accessing FTP has the most limited capabilities?
alexira [117]

Answer:

I think through a web browser as all OSs have a built in FTP client so it would be web browser

Explanation:

7 0
3 years ago
Read 2 more answers
What is the meaning for science?
ELEN [110]
Science is the special kind of knowledge.Science is the special kind of knowledge related to nature and natural phenomena.
5 0
3 years ago
The spellchecker can be found in which two locations in most wordprocessing software?
bogdanovich [222]
Editing tab or in the same section as the find comand
8 0
4 years ago
How to help it automation with python professional certificate?
arlik [135]

Answer:

Following are the answer to this question:

Explanation:

As we know, that Python is based on Oop's language, it allows programmers to decide, whether method or classes satisfy the requirements.  

  • It's an obvious benefit, in which the system tests the functions, and prevent adverse effects, and clear the syntaxes, which makes them readable for such methods.
  • All the framework uses the python language, that will be used to overcome most every coding task like Mobile apps, desktop apps, data analyses, scripting, automation of tasks, etc.
3 0
3 years ago
Allison needs to graph the yearly average snowfall in Alaska. She should use a:
bazaltina [42]

C: bar graph

bar graphs are used to track changes over time, so I would say that C is your best bet

7 0
3 years ago
Read 2 more answers
Other questions:
  • A process-based DO/S must synchronize actions across the network. When a process reaches a point at which it needs service from
    6·1 answer
  • Explain a business scenario where management information systems plays a part.
    11·1 answer
  • Melissa is visiting a Web page that her co-workers frequently update throughout the day. If she wants o make sure she has the mo
    11·1 answer
  • Which visual aid would help a group of veterinary students study a dog's anatomy?
    14·1 answer
  • This procedure protects against the loss of data
    5·1 answer
  • A local company is expanding its range from one state to fifteen states. They will need an advanced method of online communicati
    9·2 answers
  • On React
    13·2 answers
  • Do you all like IXL?
    8·1 answer
  • Braxton is writing a program to design t-shirts. Which of the following correctly sets an attribute for color?
    7·1 answer
  • Technology?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!