Find Jobs
Hire Freelancers

C++ Investment with info and code

$30-50 USD

已完成
已发布超过 20 年前

$30-50 USD

货到付款
Here is the info and code I have written (I am very new at this) INFO This program will track an investment plan to determine the amount that will accumulate over a period of time. The inputs to the program are: iAmount Initial amount invested mAmount Monthly amount invested rate Yearly interest rate nCompound Number of times per year the interest is compounded nYears Number of years for the investment the program should prompt the user for these values, then produce a table that shows yearly values for the total amount invested and the current value of the investment. The table should have three columns - the Year number, the Amount Invested and the Current Value. Make sure that the columns are aligned properly. Dollar amounts should be output with two decimal places. The formula to compute the balance of the investment is: balance = amount * (1.0 + rate/nCompound)nPeriods*nCompound where *amount* is the balance at the start of the period, *rate* is the interest rate for one period of the investment, *nCompound* is the number of times the investment is compounded per period, and *nPeriods* is the number of periods for which the amount is invested. To keep things simple, assume that the monthly amounts that are invested are all added at the beginning of each year. Write a value function to compute the balance. Your program will call this function for each year of the investment. *(This means that the call* *to the Balance() function will be made with *nPeriods* of 1 each time).* The input is going to be this 0.00 Initial amount invested 500.00 Monthly amount invested 10 Yearly interest rate 12 Number of times per year the interest is compounded 35 Number of years for the investment ## Deliverables CODE // investment .cpp // Programmer: Travis // Date: Nov 22, 2003 // // --------------------------------------------------------- // This is a program that calculates an investment and prints // it in table form // // --------------------------------------------------------- #include <iomanip> #include <iostream> #include <cmath> #include <string> using namespace std; const float NPERIODS = 1.00; float Balance ( float ); float iAmount ( float ); float table[][]; int col; int row; int y; float curVal; float mAmount; float rate; float nCompound; int nYears; int main() { cout << "Input the initial amount invested." << endl; cin >> curVal; cout << "Input the monthly amount invested." << endl; cin >> mAmount; cout << "Input the yearly interest rate." << endl; cin >> rate; cout << "Input the number of times per year the interest is compounded." << endl; cin >> nCompound; cout << "Input the number of years for the investment." << endl; cin >> nYears; table[0][0] = " Year "; table[0][1] = " Amount Invested "; table[0][2] = " Current Value "; for ( int y = 1; y < nYears; ++y) { table[y][0] = y; table[y][1] = iAmount ( curVal ); table[y][2] = Balance ( iAmount ( curVal )); curVal = Balance (iAmount ( curVal )); } for ( row = 0; row < 36; row++) { for( col = 0; col< 3; col++) cout << setprecision(2) << table[row][col]; cout << endl; } float iAmount ( float a ) { return a = mAmount * 12 + curVal; } float Balance ( float b ) { return b * pow ((1.0 + rate/nCompound),NPERIODS*nCompound); } } return 0; ## Platform C++
项目 ID: 3016479

关于此项目

6提案
远程项目
活跃20 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
See private message.
$17 USD 在2天之内
5.0 (2条评论)
0.8
0.8
6威客以平均价$24 USD来参与此工作竞价
用户头像
See private message.
$21.25 USD 在2天之内
4.9 (104条评论)
4.9
4.9
用户头像
See private message.
$11.90 USD 在2天之内
5.0 (17条评论)
4.2
4.2
用户头像
See private message.
$30.60 USD 在2天之内
5.0 (9条评论)
4.1
4.1
用户头像
See private message.
$34 USD 在2天之内
4.7 (15条评论)
3.8
3.8
用户头像
See private message.
$28.05 USD 在2天之内
4.8 (5条评论)
0.9
0.9

关于客户

UNITED STATES的国旗
United States
5.0
1
会员自11月 22, 2003起

客户认证

这个客户的其他工作

c++ investment program
$30-50 USD
谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。