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
The internet has provided great opportunities for fundraising. true/false
alekssr [168]
True, sites such as kickstarter and just giving are fantastic examples of such.
8 0
3 years ago
Many people dream of being successful, but their actions can sometimes hold them back. What are some ways you can be sure that y
Nikitich [7]

Answer:

  • make a promise
  • write it in a diary
  • make a scrap book
  • create a video
  • make a picture book

I hope this helps

<h2>I know you will do great!!!</h2>

5 0
2 years ago
What is a curson?
sp2606 [1]

Answer:

C. Blinking vertical line on your screen

Explanation:

A cursor is tha blinking vertical line on your screen.

5 0
3 years ago
Which hardware device is it most important to an experienced computer professional to install
kherson [118]

Answer:

RAM

Explanation:

In the test

3 0
3 years ago
The trust relationship between the primary domain and the trusted domain failed. what does this phrase mean?
jeka57 [31]

Answer:

It's an error message

Explanation:

This error indicates that this computer in no longer trusted and diconnected from the Active Directory since the local computer password doesn’t match this computer object password stored in the AD database. Trust relationship may fail if the computer tries to authenticate on a domain with an invalid password. Typically, this occurs after reinstalling Windows.

A system trusted by a user, is one that the user feels safe to use, and trusts to do tasks without secretly executing harmful or unauthorised programs; while trusted computing refers to whether programs can trust the platform to be unmodified from that expected, whether or not those programs are innocent, malicious or otherwise.

4 0
2 years ago
Other questions:
  • Click to move a stacked object to the top of the stack?
    8·1 answer
  • A(n) ________ variable is declared inside a module and cannot be accessed by statements that are outside the module.
    13·1 answer
  • _____________________ denotes the use of human interactions to gain any kind of desired access. Most often, this term involves e
    11·1 answer
  • In comparing a computer to the human brain, the computer's hardware is like _____ and the computer's software is like _____.
    11·1 answer
  • In order for a fault-block mountain to form, a ______ must take place along a fault line and one side must be ________.
    11·1 answer
  • Alison is having a hard time at work because her Inbox is flooded with emails every day. Some of these emails are unsolicited. S
    15·2 answers
  • Write a program that asks the user to enter two integer numbers X and Y. The program halves each number between X and Y then pri
    15·1 answer
  • Un producto tecnológico puede ser tangible o intangible?
    6·1 answer
  • 72. In Object Oriented Programming, a class_____ starts
    12·1 answer
  • Suppose a packet is 10K bits long, the channel transmission rate connecting a sender and receiver is 10 Mbps, and the round-trip
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!