GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Oct-2007, 19:03
darkone9891 darkone9891 is offline
New Member
 
Join Date: Oct 2007
Posts: 1
darkone9891 is on a distinguished road

Need help with a c++ program dealing with interest compounded monthly


sorry i know most of ya'll dont like to do homework for others, and if i did it myself it would be better for me but im failing my class and if i can get a good grade on this i will be able to stay in it long enough to learn how to do it, so if u can help me with it i would be really greatful, now i know it needs at least 2 for statments and i can use a function to print when its needed but i just cant get it heres the program they want me to write


Hulk Hogan invests in a Roth IRA. He plans to put $200 in the account on the first of each month, beginning on Jan 1, 2007. His last payment will be on Dec 1, 2036. His money earns a (% annual interest rate, compounded monthly. Calculate and print his balance on January 1 of each year, from 2007 until 2037. Do not print the other months.

now if no ones wants to help or think its better that i do it on my own i understand, i'll be workin on it myself and try to get it, its due the 30th of october, but i know i'll fail it, so thanks neway



this is what i have so far i know basics

[tagindicator]
CPP / C++ / C Code:

//this program calculates the 9% annual interest 
//of an IRA account compounded monthly then prints 
//out every january 1st for 30 years.


#include <fstream>
#include <iomanip>
using namespace std;
void main()
{
    ofstream outfile;
    ifstream infile;
    outfile.open("RothIRA.txt");
    infile.open("data.txt");

	outfile<<"This is the program of : ";
    outfile<<"Dillon Nicholson"<<"\n";
    outfile<<"CMPS 1043-02"<<"\n";
    outfile<<"Due date:";
    outfile<<" Oct 30 2007"<<"\n"<<"\n";


    //dont know what to put here i know its a for and maybe a function to        
   //print out not sure.


	outfile<<endl;
    outfile.close();
    infile.close();
}
[/tagindicator]

and i know the formula for the compounded is monthly = P (1 + r/12)12 P is the principal (the initial amount you borrow or deposit) r is the annual rate of interest (percentage), but im not sure how to have it print out every january 30 times or the right setw and setprecision or float to have it line up.
  #2  
Old 27-Oct-2007, 22:15
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,243
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Need help with a c++ program dealing with interest compounded monthly


I guess you read whatever is in your input file and use whatever data is in it to help you calculate the IRA.


For the section you don't know what to do, you will need a loop to calculate each month's balance. Then every time the month becomes January, output the current balance before calculating the new balance.

Two ways to handle the loop:
1) one loop and keep track of when January comes around
2) two loops, one to keep track of the years, and inside that loop another loop to calculate the months of the year. A little easier to keep track of when January arrives, but a more complex looping structure.
__________________

Age is unimportant -- except in cheese
 
 

Recent GIDBlogMore photos on Flickr by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two-Tier data dissemination code installation problem nidhibansal1984 Computer Software Forum - Linux 6 16-Sep-2007 10:13
Monthly Minimums on Merchant Accounts omupas eCommerce / Merchant Account Forum 0 12-Mar-2007 12:34
BOOKEEPING program, HELP!! yabud C Programming Language 10 17-Nov-2006 03:48
Pipeline freeze simulation darklightred C++ Forum 6 27-Jul-2006 19:37
Java GUI Mortgage Program Harryt123 Java Forum 0 21-Jul-2006 16:57

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:13.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.