Modify the program in exercise 3a so that the main program


1. Design a program for the following:

a. Program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Generate a separate function to do the calculation and return the result to be displayed.

b. Modify the program in Exercise 3a so that the main program prompts the user for the amount of money and passes it to the interest-calculating function.

c. Modify the program in Exercise 2b so that the main program also prompts the user for the interest rate and passes both the amount of money and the interest rate to the interest-calculating function.

2. Design a program that performs arithmetic functions.

a. Design the program to contain two numeric variables, and prompt the user for Values for the variables. Pass both variables to functions named sum() and difference(). Each function, sum() and difference() computes the sum of and difference between the values of two arguments, respectively and print the results.

b. Modify the program in Exercise 4a so that the two entered values are passed to a function named getChoice(). The getChoice() function asks the user whether addition or subtraction should be performed and then passes the two values to the appropriate function, where the result is printed.

3. Design a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to the following functions:

  • A function that displays all whole numbers from 1 up to and including the entered number
  • A function that computes the sum of all the whole numbers from 1 up to and including the entered number
  • A function that computes the product of all the whole numbers from 1 up to and including the entered number

Solution Preview :

Prepared by a verified Expert
Business Management: Modify the program in exercise 3a so that the main program
Reference No:- TGS02537119

Now Priced at $15 (50% Discount)

Recommended (97%)

Rated (4.9/5)