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
What are 2 ways that technology can negatively impact the environment.
Ahat [919]
By compromising human health and safety.
7 0
3 years ago
Read 2 more answers
Can some one help me with this please
levacccp [35]

Answer:what is it about

Explanation:

5 0
2 years ago
PLEASE HELP ME
Leto [7]

The steps to executing the above Desktop Publishing  assignment is as follows:

  1. Open Mic. rosoft Word on your computer
  2. Highlight the referenced text and paste onto the empty work space
  3. Highlight all the text using CTRL + A
  4. Navigate to the Justification Button/ Tool as shown in the image and click
  5. While keeping the text highlighted, click on the "Line and Spacing Tool" as indicated in the image
  6. Select the "1.5" spacing action button
  7. Use CTRL + S to save your work.

<h3>What is desktop publishing?</h3>

Desktop publishing is the process of creating documents on a computer using page layout software. It was virtually solely used for print publications at initially, but it now now aids in the development of numerous types of web material.

A desktop publishing software (DTS), sometimes known as a "page layout program" or "publishing program," has full page design features, such as magazine-style columns, rules and borders, page, chapter, and caption numbering, and accurate typographic alignment.

Learn more about desktop publishing:
brainly.com/question/7221277
#SPJ1

8 0
1 year ago
a ____ consists of wires connecting the cpu and other parts of the computer. The _____ transfers data between CPU and memory uni
geniusboy [140]

Answer:

A power supply consists of wires connecting the cpu and other parts of the computer. The data bus transfers data between CPU and memory unit.

Explanation:

4 0
3 years ago
An email message containing a warning related to a non-existent computer security threat, asking a user to delete system files f
LenKa [72]

Answer: Virus Hoax

Explanation:

A computer virus hoax is a message that warns someone of a false virus threat. It is a a chain email that encourages who ever has received the message to pass it to other people as a form of warning.

5 0
3 years ago
Other questions:
  • Write a Java application that inputs a series of 10 integers and determines and prints the largest and smallest integer. Use a c
    12·1 answer
  • Which one of the following statements is correct? a. Web browsers cannot function without cookies. b. Cookies are text files and
    9·1 answer
  • Pleaseeee help me w this!
    10·1 answer
  • Which of the following statements are true about quick sort
    12·1 answer
  • Which of the following could be a constructor for the public class MyClass? a. public MyClass() b. public void MyClass() c. publ
    7·1 answer
  • Devon would like to install a new hard drive on his computer. Because he does not have a SATA port available on his motherboard,
    7·1 answer
  • Okay, guys, I know this one will be very hard however while trying to finish this assignment I got overwhelmed and lost by the s
    9·1 answer
  • Define the terms of data and information .​
    6·1 answer
  • Please help if you answer correcly i will give you brainelst!!!!!!!!!!!!!!!!!!
    6·2 answers
  • What is a database and provide 2 examples of how you are using a database.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!