Write a program that reads an initial investment balance


R7.1 Carry out the following tasks with an array:

a. Allocate an array a of ten integers.
b. Put the number 17 as the initial element of the array.
c. Put the number 29 as the last element of the array.
d. Fill the remaining elements with -1.
e. Add 1 to each element of the array.
f. Print all elements of the array, one per line.
g. Print all elements of the array in a single line, separated by commas.

R7.2 What is an index of an array? What are the legal index values? What is a bounds error?

R7.4 Write a loop that reads ten numbers and a second loop that displays them in the opposite order from which they were entered.

P7.1 A run is a sequence of adjacent repeated values. Write a program that generates a sequence of 20 random die tosses in an array and that prints the die values, marking the runs by including them in parentheses, like this:

12 (5 5) 3 1 2 4 3 (2 2 2 2) 36 (5 5) 631

Use the following pseudocode:

Set a boolean variable inRun to false.
for each valid index i in the array
If inRun
If values[i] is different from the preceding value
Print ).
inRun = false.
If not inRun
If values[i] is the same as the following value
Print
inRun = true.
Print values[i].
If inRun, print ).

1. For a given number, print a pyramid of that many levels. We've covered how to print out half of the pyramid similar to the following:
*
**
***
****
*****

Now we want to print (notice the spacing)

     **
   ****
  ******
 ********
**********

2. Write a program that lists the first 400 multiples of 13. List that number, followed by whether it is even or odd.

3. Write a program that adds a letter to a string until the user wants to quit.

4. Write a program that reads an initial investment balance and an interest rate. Then print the number of years it takes for the investment to reach one million dollars.

Solution Preview :

Prepared by a verified Expert
Programming Languages: Write a program that reads an initial investment balance
Reference No:- TGS01525922

Now Priced at $35 (50% Discount)

Recommended (90%)

Rated (4.3/5)