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
Pani-rosa [81]
4 years ago
14

Write a program that calculates the balance of a savings account at the end of a period of time. It should ask the user for the

annual interest rate, the starting balance, and the number of months that have passed since the account was established. A loop should then iterate once for every month, performing the following: A) Ask the user for the amount deposited into the account during the month. (Do not accept negative numbers.) This amount should be added to the balance. B) Ask the user for the amount withdrawn from the account during the month. (Do not accept negative numbers.) This amount should be subtracted from the balance. C) Calculate the monthly interest. The monthly interest rate is the annual interest rate divided by twelve. Multiply the monthly interest rate by the balance, and add the result to the balance. After the last iteration, the program should display the ending balance, the total amount of deposits, the total amount of withdrawals, and the total interest earned.

Computers and Technology
1 answer:
Elden [556K]4 years ago
4 0

Answer:

Check the explanation

Explanation:

# include <iostream>

#include<iomanip>

using namespace std;

int main ()

{double start,balance,rate,deposit=0,withdraw=0,amt,sum,totInterest=0,interest;

int i;

cout<<setprecision(2)<<fixed;

cout<<"Enter starting balance: ";

cin>>balance;

start=balance;

cout<<"Enter annual interest rate: ";

cin>>rate;

rate/=12.;

for(i=1;i<=3;i++)

  {cout<<"For month "<<i<<endl;

  sum=balance;

   cout<<"Enter total amount deposit: ";

   cin>>amt;

   while(amt<0)

       {cout<<"Must not be negative-retry\n";

       cout<<"Enter total amount deposit: ";

       cin>>amt;

       }

   deposit+=amt;

   balance+=amt;

   cout<<"Enter total amount withdrawn: ";

   cin>>amt;

   while(amt<0||amt>balance)

       {cout<<"Must not be negative, or greater than balance ($"<<balance<<")-retry\n";

       cout<<"Enter total amount withdrawn: ";

       cin>>amt;

       }

   withdraw+=amt;

   balance-=amt;

   interest=(sum+balance)/2.*rate;

   totInterest+=interest;

   balance+=interest;

}

cout<<"Starting balance at the beginning of the three month period: $"<<start<<endl;

cout<<"total deposits made during the three months: $"<<deposit<<endl;

cout<<"total withdrawals made during the three months: $"<<withdraw<<endl;

cout<<"total interest posted to the account during the three months $"<<totInterest<<endl;

cout<<"final balance: $"<<balance<<endl;

system("pause");

return 0;

}

Kindly check the output in the attached image below.

You might be interested in
How was WiFi discovered?
postnew [5]

Answer:

An Australian scientist by the name of John O'Sullivan was inspired by Stephen Hawking's theory of evaporating black holes and their subsequent radio waves. He set out to find them and prove the theory correct. (Wi-Fi was discovered on accident)

7 0
3 years ago
The ________ is a system of interlinked documents on the Internet, or a graphical user interface to the Internet that provides u
RSB [31]

Answer:

World Wide Web (WWW)

Explanation:

Popularly referred to as the Web is an information system that comprises of many interconnected web resources and documents. These documents and web resources possess a certain URL (Uniform Resources Locators) such as https://www.brainly.com/ which makes them accessible over the internet.

The <em>HTTP or Hypertext Transfer Protocol</em> is a channel for transferring the resources of the World wide web among users.

In 1989, the World Wide Web was invented by Tim Berners-Lee. He developed the first web browser in 1990.

The World Wide Web has played a fundamental role in the advancement of the information age as it is greatly used by different people around the world to communicate efficiently.

6 0
3 years ago
True or false you have no control over who views your social network information
il63 [147K]
  Your answer would be false. That's what you have security settings for.
4 0
4 years ago
Read 2 more answers
What command would you use to view the path taken by an ethernet packet in windows?
Anni [7]
Hey there,
The answer is <span>tracert.

Hope this helps :))

~Top
</span>
5 0
3 years ago
Consider the following MARIE Code: 100 If, Load X /Load the first value 101 Subt Y /Subtract the value of Y, store result in AC
Nataliya [291]

The program is given below:-

<u>Explanation:</u>

100 If, Load X /Load the first value

101 Subt Y /Subtract the value of Y, store result in AC

102 Skipcond 400 /If AC=0 (X=Y), skip the next instruction

103 Jump Else /Jump to Else part if AC is not equal to 0

104 Then, Load X /Reload X so it can be doubled

105 Add X /Double X

106 Store X /Store the new value

107 Jump Endif /Skip over the false, or else, part to the end of if

108 Else, Load Y /Start the else part by loading Y

109 Subt X /Subtract X from Y

10A Store Y /Store Y-X in Y

10B Endif, Halt /Terminate program (it doesn't do much!)

10C X, Dec 12 /Assume these values for X and Y

10D Y, Dec 20

6 0
4 years ago
Other questions:
  • Francis has designed a picture book appropriate for third graders. He wants teachers across the world to freely download use, an
    9·1 answer
  • Based on your learning this week, consider rules, policies, and procedures. Technicians are often eager to just get started on a
    10·1 answer
  • The Joint Photographic Experts Group developed the ___________ graphic format.
    12·2 answers
  • First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==&gt; Close All Projects).
    6·1 answer
  • What's it called when a program is expandable?
    10·1 answer
  • A(n) ________ is a server-based operating system oriented to computer networking and may include directory services, network man
    5·1 answer
  • Plsss help anyone PLSSSSS ​
    13·1 answer
  • Consider the following code segments that are potential replacements for /* missing code */.
    6·1 answer
  • Question #2
    5·1 answer
  • A major concern in the home is the __________ of young children. (6 Letters)
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!