preview

Homework Chapter 3 Essay

Good Essays

Multiple Choice
1) Module
2) Divide and Conquer
3) Header
4) Call
5) Return
6) Top-down Design
7) Flowchart
8) Local Variable
9) Scope
10) Argument
11) Parameter
12) By Value
13) By Reference
14) Global variable
15) Global

True or False
1) False
2) True
3) True
4) False
5) True
6) False
7) False
8) True
9) True
10) False
11) True
12) False

Short Answers
1) You can call the module several times instead of writing it out each time.
2) The header is the starting point and the body is a list of statements that belong to the module.
3) It will return back to its previous point in the program.
4) A local variable is declared inside the module only. Only the statements inside the module can access it.
5) A …show more content…

Module main() call salesTax
End Module

Module salesTax(Integer Value)
Declare Integer tax
Set tax = value * 0.02 * 0.04
Display tax
End Module

3. How Much Insurance? Many financial experts advise that property owners should insure their homes or buildings for at least 80 percent of the amount it would cost to replace the structure. Design a modular program that asks the user to enter the replacement cost of a building and then displays the minimum amount of insurance he or she should buy for the property.

Module main()
Call amount
Display cost
End Module

Module amount
Declare Integer cost
Display “Enter price”
Set cost = value * .80
End Module

4. Automobile Costs Design a modular program that asks the user to enter the monthly costs for the fol-lowing expenses incurred from operating his or her automobile: loan payment, in-surance, gas, oil, tires, and maintenance. The program should then display the total monthly cost of these expenses, and the total annual cost of these expenses.

Module main()
Declare Integer number
Display " Enter loan”
Input loan
Declare Integer number
Display " Enter insurance”
Input insurance
Declare Integer number
Display " Enter gas”
Input gas
Declare Integer number
Display " Enter oil”
Input oil
Declare Integer number
Display " Enter tires”
Input tires
Declare Integer number
Display " Enter maintenance”
Input maintenance
Call totalCost(

Get Access