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
Please save the program with the name ‘triangle.c’
konstantin123 [22]

Answer:

1. #include <stdio.h>

2. int main()

3. {

4.     int k;

5.     int j;

6.     int i;

7.     int array[7];

8.     array[0] = 1;

9.     for (i = 1; i < 9; ++i)

10.     {

11.        array[i] = array[i-1]*2;

12.        for (j=0; j < i; ++j)

13.        {

14.          printf("%d ",array[j]);

15.        }      

16.        for (k=i-2; k > -1; --k)

17.        {

18.          printf("%d ", array[k]);  

19.        }

20.        printf("\n");      

21.     }  

22.     return 0;

23. }

Explanation:

  • From line 1 to 3 we start the main function
  • From line 4 to 7 we declare the variables that we are going to be using throughout the program including an array of 7 positions
  • On line 8 we initialize the array with one to match the sequence
  • From line 9 to 10 we create a for loop to create the 9 sequences of numbers
  • On line 11 we assign values to the array by taking the previous value and multiplying it by 2, this way we can create the sequence 1,2,4,8,32...
  • From line 12 to 15 we print the ordered array
  • From line 16 to 19 we print the inverse array minus one  
  • On line 20 we print an enter

7 0
3 years ago
What section of the outline is represented by "A. Africa?"
nikklg [1K]
I think it’s number one...
7 0
3 years ago
Read 2 more answers
If wire rope guardrails are used, what must also be done? A. No further action is required B. They must be flagged with highly v
zavuch27 [327]
Your answer would be b hope i helped please mark me brainliest
5 0
2 years ago
Read 2 more answers
When was "Rick Astley Never Gonna Give You Up" originally made?
Zepler [3.9K]

Answer: See explanation

Explanation:

Rick Astley "Never Gonna Give You Up" was originally recorded in October 1986 and was then released on 27th July, 1987.

The song was recorded in South London at the PWL studios. On the American billboard hot 100, it reached number one in March 1988.

6 0
3 years ago
Read 2 more answers
What is the primary language used to write web content and is the default format for Outlook messages?
iris [78.8K]

Answer:

HTML

Explanation:

It is the HTML format, and it is the default format for Outlook messages as well. However, the Outlook messages support the Rich Text Format and Plain text as well. However, the default format is certainly the HTML format. And the rest of the options can be selected. Hence, the correct option for this question is certainly the HTML.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Zach follows the instructions that show him how to create a custom Web site in his school's learning management system. These st
    14·1 answer
  • A user clicked an email link that led to a website than infected the workstation with a virus. The virus encrypted all the netwo
    10·1 answer
  • True or false: within a database, fields can be added, deleted and edited but never moved.
    11·1 answer
  • Which approach to knowledge management capitalizes on tacit knowledge and requires heavy IT investment?
    7·1 answer
  • Be my friend plzzzzzzz
    7·2 answers
  • Mobile app designers who work for themselves are often dubbed _____.
    10·1 answer
  • Expain the application areas of ICT in education sector and E-commerce​
    12·1 answer
  • What type of waves in the electromagnetic spectrum has the Search for Extraterrestrial Intelligence (SETI) mostly analyzed in th
    15·1 answer
  • Write a program that will input a list of test scores in from the keyboard. When the user enters -1, print the average.
    6·2 answers
  • How to make a website
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!