C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 3rd, 2004, 05:34 PM
steve123456 steve123456 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 1 steve123456 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
C++ school assignment

I need some help on this program I am working on :

"Create a program that will prompt the user to enter a monthly interest rate, the amount of a monthly deposit and a target value. Then starting with a zero balance, calculate the number of years and months needed to reach the target with monthly compounding. An Example output follows: (red text indicates user input)
*** Financial Planner ***

Please enter the monthly interest rate: 2.5

Please enter the monthly deposit amount: $50

Please enter the target value: $50000

Your balance will be $50019.10 after 10 years and 11 months.

Notes:

The interest rate will have to be adjusted for calculations.
Initial balance = 0, after first month add $50 then add 2.5% of the account balance to obtain first month-end balance. Second month, add the month’s $50 deposit and add 2.5% of the account balance to obtain second month-end balance. Continue until target value is reached."

__________________________________________________ _____________
I am pretty new to c++ and here is what i have started:

#include <iostream.h>

int main()
{

// variables
float interest;
float deposit;
float target;
float balance;

cout << "Please enter the monthly interest rate:\n";
cin >> interest;
cout << "Pease enter the amount of a monthly deposit:\n";
cin >> deposit;
cout << "Please enter the target value:\n";
cin >> target;

balance=0;
while (balance <= target);

while (balance += (balance * interest));

while (balance += deposit);


{
cout <<"Your balance will be "
<<balance << " after ";

}

return 0;
}


URL

Reply With Quote
  #2  
Old May 3rd, 2004, 06:46 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
What is the problem exactly? Can you be more specific? Please don't ask for you assignments to be done here.
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old July 12th, 2005, 12:14 AM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
Geo

Well I'm only a student as well and I'm not even in my major classes yet but I have read two books on C++ programming. That doesn't mean I know anything though. If your getting a syntax error when you try to compile this, its probably because your putting a .h behind #include <iostream> = I use Visual Studio 2005 beta, Im not sure what your using but when I put the .h behind i get a cannot open error!!!
Let me know if this helps you out!!!

Last edited by Geo.Garnett : July 12th, 2005 at 01:06 AM. Reason: Forgot to add what Program I use!!

Reply With Quote
  #4  
Old July 13th, 2005, 05:14 AM
proghelper proghelper is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 12 proghelper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 21 sec
Reputation Power: 0
In addition to dropping .h in #include <iostream.h> you also have to use
using namespace std;

e.g.
Code:
 #include <iostream>
  using namespace std;


If you are wondering why we have to drop .h, well, .h file was the old header, and the one wihtout .h is the latest header file.

-----
Programming (Assignment/Project) Help

Reply With Quote
  #5  
Old July 15th, 2005, 11:41 AM
hacker be hacker be is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 4 hacker be User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 20 sec
Reputation Power: 0
Thumbs up

Quote:
Originally Posted by steve123456
I need some help on this program I am working on :

"Create a program that will prompt the user to enter a monthly interest rate, the amount of a monthly deposit and a target value. Then starting with a zero balance, calculate the number of years and months needed to reach the target with monthly compounding. An Example output follows: (red text indicates user input)
*** Financial Planner ***

Please enter the monthly interest rate: 2.5

Please enter the monthly deposit amount: $50

Please enter the target value: $50000

Your balance will be $50019.10 after 10 years and 11 months.

Notes:

The interest rate will have to be adjusted for calculations.
Initial balance = 0, after first month add $50 then add 2.5% of the account balance to obtain first month-end balance. Second month, add the month’s $50 deposit and add 2.5% of the account balance to obtain second month-end balance. Continue until target value is reached."

__________________________________________________ _____________
I am pretty new to c++ and here is what i have started:

#include <iostream.h>

int main()
{

// variables
float interest;
float deposit;
float target;
float balance;

cout << "Please enter the monthly interest rate:\n";
cin >> interest;
cout << "Pease enter the amount of a monthly deposit:\n";
cin >> deposit;
cout << "Please enter the target value:\n";
cin >> target;

balance=0;
while (balance <= target);

while (balance += (balance * interest));

while (balance += deposit);


{
cout <<"Your balance will be "
<<balance << " after ";

}

return 0;
}


URL

hello you ! i am beginer in C++ .Code is :
#include<iostream.h>

float Monthly(float interest_rate,float monthy_deposit,float target_value);

int main()
{
cout<<"month is :"<<Monthly(0.25,50,50000);
return 0;
}
float Monthly(float interest_rate,float monthy_deposit,float target_value)
{
float month=int ();//hoac int month =int ()
while (monthy_deposit<target_value)
{
monthy_deposit=(monthy_deposit)+(interest_rate*mon thy_deposit);
month++;
}
return month;
}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > C++ school assignment


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway