Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Would like some help organizing a program in Java for this: Write a program that prompts the user to specify a financial function to use,

Would like some help organizing a program in Java for this:

Write a program that prompts the user to specify a financial function to use, then calculates and displays the appropriate value. Assume that interest compounds monthly, round money to the nearest penny, and use methods to for the four calculations. Use Math class functions as much as possible. The functions will help the user answer the following questions:

1. If you deposit P dollars in a savings account, how much money, F, would be in the account after n years? (Future Value of a Single Sum)

2. How much would you have to deposit in a savings account today, P, in order to have F dollars in the account after n years? (Present Value of a Single Sum)

3. If you made monthly deposits of A dollars in a savings account, how much money would be in the account after n years? (Future Value of an Annuity)

Formulas for performing the above calculations are as follows:

Future Value of a Single Sum: F = P * (1 + i)n

Present Value of a Single Sum: Solve above equation for P

Future Value of an Annuity: F = P * [ {(1 + i)n -1}/i]

where i = periodic interest rate and n = number of years

Example

If you deposit $100 in a savings account that pays interest at 5 percent per year, how much would you have in the account after 2 years? Assume that interest is compounded monthly and round the dollar amount to the nearest penny.

i = .05/12 = .004167, n = 2 * 12 = 24, P = 100

F = 100 * ( 1 + .004167 ) 24 = 100 * 1.10495 = $110.50

Part B)

Write a program that prompts the user to enter integers in the range 1 to 50 and counts the occurrences of each integer. The program should also prompt the user for the number of integers that will be entered.

As an example, if the user enters 10 integers (10, 20, 10, 30, 40, 49, 20, 10, 25, 10), the program output would be:

10 occurs 4 times

20 occurs 2 times

25 occurs 1 time

30 occurs 1 time

40 occurs 1 time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+ Who do you think is right? Why?

Answered: 1 week ago