logo CodeStepByStep logo

Investment

Write a console program in a class named Investment that calculates money earned by two investors. Use the following compound interest formula:

PV * (1 + r)n = FV

Also report the overall "quality" of the investment as from the table below:

Profit Category
0 - 10% weak
10 - 50% medium
over 50% strong

Match the following example output log (with user input shown like this):

Investor #1:
Initial amount? 100.00
Interest rate%? .03
Num. of months? 5
Final amount = $115.93
Profit = $15.93 (16%)
medium

Investor #2:
Initial amount? 5.25
Interest rate? .08
Num. of months? 24
Final amount = $33.29
Profit = $28.04 (534%)
strong

Have a nice day!

You should break down your program into several methods, each of which helps solve the overall problem. Use the printf method to format real numbers with proper precision.

Complete program: Write an entire program that you could put into a file and run outside of CodeStepByStep.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.