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
_____ is used to temporarily hold small units of program instructions and data immediately before, during, and after execution b
Mazyrski [523]

Answer: A register

Explanation:

Registers are small memory used to store data or values and supply them to the processor as and when needed. These register hold the data temporarily and hold small units of program instructions. So whenever the CPU wants to work on data they have to be made available through the registers. Even after a arithmetic operation the registers serve as buckets for holding the value.

There are different types of registers such as register A, B, C etc and these registers lie in close proximity to the CPU so that we could provide the data immediately and much faster when asked by the CPU.

Therefore we can say that registers are used to temporarily hold small units of program instructions and data immediately before, during, and after execution by the central processing unit (CPU).

8 0
3 years ago
Which of the following is a template definition?
musickatia [10]

Answer:

b. template<classT>.

Explanation:

Template functions are that can work with generic types. Template lets us to create a function so that more than 1 type or class can adapt  the functionality of that function.

We can write the template function as following:-

template<class typename>.

It matches to the option b.

5 0
2 years ago
...This is totally a question
kramer

Answer: No Answer

Explanation: No Explanation

6 0
3 years ago
Which OS function does a CLI fulfill? A User interface B Running applications C Hardware interface D Booting
konstantin123 [22]

Answer:

User Interface

Explanation:

4 0
3 years ago
The first project that this position will work on is an embedded sensor that will send readings periodically to the cloud, and h
Mice21 [21]

Answer:

we need PLC(Programmable Logic Units) attached to the sensors  and those sensors will take the signals/values  and transfer them to the cloud .In cloud we store that information and send that information to the web application where user is able to view

Explanation:

it looks like a SCADA system. we can integrate PLC with SCADA

or

for developing PLC we can use c or c++.it contain logic to transfer data to cloud

for cloud storage we can use Microsoft azure which is useful for data storage in sql servers

for web application we can use ASP.Net to interact with cloud and get data from there and display the results to the user on UI

6 0
3 years ago
Other questions:
  • Morgan is the operations manager for a national appliance distributor. The company has offices throughout the United States. Com
    7·1 answer
  • Software design and implementation are interleaved activities. The level of detail in the design depends on the type of system b
    5·1 answer
  • Is the cell phone changing our views about polite and impolite behavior? For example,
    15·2 answers
  • Which is an internet service?<br><br> Antivirus<br> Chat<br> Firewall<br> Router
    8·2 answers
  • What is the name of the option in most presentation applications with which you can modify slide elements? The ( answer here )op
    9·1 answer
  • When you need to cut new external threads on a bolt, which of the following tools should you use?
    9·2 answers
  • Please choose the correct option please tell fast​
    9·1 answer
  • NEED HELP
    9·1 answer
  • Meaning and explanation of fortran​
    11·2 answers
  • In which of the following movies, multimedia's special effect is used ? *
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!