Đã hoàn thành

C++ Investment with info and code

Here is the info and code

I have written (I am very new at this)


This program will track an investment plan to determine the amount

that will accumulate over a period of time. The inputs to the program


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


// 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


Kĩ năng: Lập trình C, Kĩ thuật, MySQL, PHP, Kiến trúc phần mềm, Kiểm tra phần mềm

Xem nhiều hơn: string in c programming, string in cpp, string c programming, string cpp, programming with cpp, programmer info, float programming, float c programming, c string programming, c programming string, c programming input output, cpp string, cpp programming, cpp int to string, c for int, c# beginning, beginning programming, beginning c programming, travis c, std

Về Bên Thuê:
( 1 Nhận xét ) United States

ID dự án: #3016479

Được trao cho:


See private message.

$17 USD trong 2 ngày
(2 Đánh Giá)

6 freelancer đang chào giá trung bình $24 cho công việc này


See private message.

$21.25 USD trong 2 ngày
(104 Nhận xét)

See private message.

$11.9 USD trong 2 ngày
(17 Nhận xét)

See private message.

$30.6 USD trong 2 ngày
(9 Nhận xét)

See private message.

$34 USD trong 2 ngày
(15 Nhận xét)

See private message.

$28.05 USD trong 2 ngày
(5 Nhận xét)