Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions