Question: NOTE: C++ IN MICROSOFT VISUAL STUDIO 1) Compute and output compound interest on $1000.00 for 10 years at interest rates of 5%, 6%, 7%, 8%,

NOTE: C++ IN MICROSOFT VISUAL STUDIO

1)

Compute and output compound interest on $1000.00 for 10 years at interest rates of 5%, 6%, 7%, 8%, 9% and 10%

This is an exercise in creating nested loops. You must have an inner loop that calculates compound interest via

For 1 to 10 amt = rate*amt + amt;

You should have an outer loop that iterates the rate from 0.05 to 1.0.

Interest on $1000.00 over 10 years

rate total

0.05 $1628.89

0.06 $1790.85

0.07 $1967.15

0.08 $2158.92

0.09 $2367.36

0.1 $2593.74

Press any key to continue . . .

2)

Write a program that has a function prototype before main and an implementation of the function after main. The function to be implemented is a coin toss simulation using the random number generator. The function should return 1 or true 50% of the time and 0 or false 50% of the time. Use srand and the system time to make the program run differently each time. (srand(time(NULL));). Keep track of the number of head and tails for 10, 100, 1000, 10,000, 100,000 and 1,000,000 trials. Output the number of heads and tails and number of each as a percentage of the total. Notice that the more trials the more accurate your simulation becomes.

Example Program Session:

Trials: 10 Head count: 6 Percent Heads 60.00 Tail Count: 4 Percent Tails 40.00 
Trials: 100 Head count: 57 Percent Heads 57.00 Tail Count: 43 Percent Tails 43.00 
Trials: 1000 Head count: 460 Percent Heads 46.00 Tail Count: 540 Percent Tails 54.00 
Trials: 10000 Head count: 4983 Percent Heads 49.83 Tail Count: 5017 Percent Tails 50.17 
Trials: 100000 Head count: 50105 Percent Heads 50.10 Tail Count: 49895 Percent Tails 49.90 
Trials: 1000000 Head count: 500135 Percent Heads 50.01 Tail Count: 499865 Percent Tails 49.99 
Try Again (1) Exit (0)1 
Trials: 10 Head count: 2 Percent Heads 20.00 Tail Count: 8 Percent Tails 80.00 
Trials: 100 Head count: 43 Percent Heads 43.00 Tail Count: 57 Percent Tails 57.00 
Trials: 1000 Head count: 484 Percent Heads 48.40 Tail Count: 516 Percent Tails 51.60 
Trials: 10000 Head count: 5005 Percent Heads 50.05 Tail Count: 4995 Percent Tails 49.95 
Trials: 100000 Head count: 49881 Percent Heads 49.88 Tail Count: 50119 Percent Tails 50.12 
Trials: 1000000 
Head count: 499958 Percent Heads 50.00 Tail Count: 500042 Percent Tails 50.00 

Try Again (1) Exit (0)0

Press any key to continue . . .

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!