Modularity Homework:

 

Implement the following functions. For each argument, indicate “passed by value” or “passed by reference”.

 

  1. Write a function called DisplayTowson with no arguments that displays:

 

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

Towson University

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

            Show a sample call.

  1. Write a function called DisplayCollegeName that has college name as the argument. Show a sample call that will display Towson University.
  2. Write a function called DisplayArea that displays the area of a room when the width and length are passed as arguments.
  3. Write a function called CalculateArea that calculates the area of a room when the width and length and area are passed as arguments. Show a sample call.
  4. Write a function called Area that calculates the area of a room and returns area when the width and length are passed as arguments. Show a sample call.
  5. Write a function called CalculatePerimeter that calculates the perimeter when the width and length and perimeter are passed as arguments. Show a sample call.
  6. Write a function called Perimeter that calculates the perimeter of a room and returns perimeter when the width and length are passed as arguments. Show a sample call.
  7. Write a function called GetDimensions with two arguments width and length that prompts for and receives width and length.
  8. Write a function called PrintDimensions with two arguments width and length that displays width and length.
  9. Write a function called CalculateSalesTax with arguments purchaseAmt and salesTaxrate and salesTax that calculates sales tax.

 

 For the following problems:

a. write a hierarchy chart

b. write code for main and all other modules

c. trace

 

1. Design an algorithm that will input sales volume records (until -1) from the user and print  the sales commission owing to each salesperson. Input includes salesperson number, name and that person's volume of sales for the month. The commission rate varies according to the sales volume:

On sales volume of :        Commission rate (%):

$0.00-$200.00                  5

$200.01-$1000.00            8

$1000.01-$2000.00        10

$2000.01 and above        12

 

Commission = commission rate * volume

Your program is to print the salesperson's number, name, volume of sales and calculated commission.

 

2. Design an algorithm that will prompt for and receive your current check book balance, followed by a number of financial transactions. Each transaction consists of a transaction code and a transaction amount. The code can be a 'D' for deposit or 'C' for check. Your program is to add each deposit amount to the balance and subtract each check amount. After each transaction is processed, a new running balance is displayed, with a warning message if the balance becomes negative. When there are no more transactions a 'Q' is entered as the transaction code. Your algorithm is to then display the initial and final balance along with the number of checks and deposits that were made.