Question: 2. Write a program that will generate 5 random numbers between 20 and 80 and assign each to a variable of datatype double. You should

 2. Write a program that will generate 5 random numbers between

2. Write a program that will generate 5 random numbers between 20 and 80 and assign each to a variable of datatype double. You should use a random number generator seeded with time Using a series of if statements, determine which of the 5 variables contains the smallest value generated Print all five random numbers to the screen and print out the value that you determined was the smallest. All values should be printed with zero decimal places 3. Write a program that will calculate the amount of money in a bank account at four different periods of time given a starting amount of money and an interest rate that is entered by the user Your program should: Prompt the user to enter the Principal (P) that is used to start the account. Read this value from the user Prompt the user to enter the annual interest rate (r) that is used to start the account. Read this value from the user Using a random number generator, seeded with time, generate four numbers to represent the amount of time, (use tl, t2, t3, t4), in years that the money is invested. The generator should generate values for time between 1 year and 20 years. Use the formula below to calculate the amount of money, A, in the account after the four periods of time(tl, t2, t3, t4) given the Principal (P) and annual interest rate (r) supplied by the user Print the results in a table with two columns (Time and Amount) with a label at the top of each column. Test your program with P- $2000 r-5% (Note: in the formula, 5% will be converted to 0.05 For the program, read in 5 from the user, and convert the number to 0.05 by applying an appropriate factor

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!