Em Andamento

C++ Investment with info and code

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

[url removed, login to view] Initial amount invested

[url removed, login to view] 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 = [url removed, login to view];

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

Habilidades: Programação C, Engenharia, MySQL, PHP, Arquitetura de software, Teste de Software

Ver mais: string cpp, programming cpp, programmer info, float programming, string programming, programming string, programming input output, cpp string, cpp programming, cpp int string, beginning programming, travis c, std, pow, investment plan, endl, string float, amount code, php form table output, dollar per form, code cpp, means php code, code track, value investment program, code call number

Acerca do Empregador:
( 1 comentário ) United States

ID do Projeto: #3016479

Premiar a:

lehuray

See private message.

$17 USD em 2 dias
(2 Avaliações)
0.8

6 freelancers estão ofertando em média $24 para este trabalho

senzaciosnegyes

See private message.

$21.25 USD in 2 dias
(104 Comentários)
4.9
RitchieM

See private message.

$11.9 USD in 2 dias
(17 Comentários)
4.2
exceptionalcoder

See private message.

$30.6 USD in 2 dias
(9 Comentários)
4.1
shashikhanvw

See private message.

$34 USD in 2 dias
(15 Comentários)
3.8
thanasisk

See private message.

$28.05 USD in 2 dias
(5 Comentários)
0.9