Re: Investment Calculator

Can you explain what values in the print out are wrong and add some comments to show what they should be?

Re: Investment Calculator

Yes, absolutely.

My output should look something like this...

Code :

Percent gain / loss: 250.0%
Amount gain / loss: $125,000.00

But instead it looks like this:

Code :

Percent gain / loss: 250000.0%
Amount gain / loss: $125.0

--- Update ---

I have some issues of zero's not being in the right place. Clearly.

Re: Investment Calculator

You need to look at each of the equations that compute the values of the variables that have the wrong values.

First do the math for each computation on a piece of paper.

Then add a println statement after EVERY statement that computes a value that prints out the value of the results.

Compare the numbers that were computed manually and written on paper with those that were printed by the program. That will show you which statement in the program is doing it incorrectly.

If you have a problem with understanding and fixing a statement, post the statement and the values that it used and the results that it computed along with what you want the results to be.

For example:

The statement: var = 3/4;

The results: var = 0

Desired results: 0.75