7 total questions
- Algorithm Workbench questions 5 and 6 from chapter 3
- Debugging Exercises questions 1 and 4 from chapter 3
- Programming Exercises questions 3, 5-6 (using SFC or Flowgorithm) from chapter 3
book information
intro to Comp Programming (Access)(CUSTOM)(FSC)(COP1000)Author:GehrigISBN: 9781323717929
View Questions Studyp X
A connections.fsc.edu – M X
Y mobile vibe – Yahoo Sear x
M Announcements – Spring
llections.pearsoned.com/student/#player/Oac608fa-5f23-11cd-815f-35fd7eff0520/0ac608fa-5f23-11cd-815f-35fd7effo
Assume that the same program has a main module with the following variable
declarations:
Declare Integer age
Declare Real income
Declare String name
Write a statement that calls the display module and passes these variables to it.
5. Design a module named getNumber, which uses a reference parameter variable to
accept an Integer argument. The module should prompt the user to enter a num-
ber and then store the input in the reference parameter variable.
/
What will the following pseudocode program display?
Module main()
Declare Integer x = 1
Declare Real y = 3.4
Display x, “”, y
call changeus (X, Y)
Display x, “”, Y
End Module
Module changeus (Integer a, Real b)
set a = 0
Set b = 0
Display a,
b
End Module
7. What will the following pseudocode program display?
Module main()
Declare Integer x = 1
Declare Real y = 3.4
Display x, ” “, Y
Call changeus (X, Y)
Page
39 of 44
MANN
20180214_161257Jpg
20180214_161236.jpg
20180214_161236P9
P Pearson Collections
Y fscj bookstore efollett – X
urces for Chapter 3 X
e Order Details
DO
ons.pearsoned.com/student/#player/0ac608fa-5f23-11cd-815f-35fd7eff0520/0ac608fa-5f23-11cd-8
Modules
Debugging Exercises
1. Find the error in the following pseudocode.
Module main()
Declare Real mileage
call getMileage()
Display “You’ve driven a total of “, nileage,
End Module
T.
“miles.
Module getMileage()
Display “Enter your vehicle’s mileage.”
Input mileage
End Module
2. Find the error in the following pseudocode.
Module main()
call getcalories ( )
End Module
Module getcalories)
es for Chapter 3 X
P Pearson Collections
X
Y Isg bookstore efollett-X
e Order Details – Order #9 x
ns.pearsoned.com/student/#player/0ac608fa-5f23-11cd-815f-35fd7eff0520/0ac608fa-5f23-11cd-815f-35fd7effo
total sales tax, and the total of the sale (which is the sum of the amount of purchase
plus the total sales tax). Refactor this program so the subtasks are in modules.
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 struc-
ture. 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. .
4. Automobile Costs
Design a modular program that asks the user to enter the monthly costs for the
following expenses incurred from operating his or her automobile: loan payment,
insurance, 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.
5. Property Tax
A county collects property taxes on the assessment value of property, which is 60
percent of the property’s actual value. For example, if an acre of land is valued at
$10,000, its assessment value is $6,000. The property tax is then 64¢ for each
$100 of the assessment value. The tax for the acre assessed at $6,000 will be
$38.40. Design a modular program that asks for the actual value of a piece of
property and displays the assessment value and property tax.
6. Body Mass Index
Design a modular program that calculates and displays a person’s body mass index
(BMI). The BMI is often used to determine whether a person with a sedentary life-
style is overweight or underweight for his or her height. A person’s BMI is calcu-
lated with the following formula:
BMI = Weight X 703/Height?
7. Calories from Fat and Carbohydrates
A nutritionist who works for a fitness club helps members by evaluating their diets.
Display number
End Module
4. Find the error in the following pseudocode.
Module main()
call raiseToPower(2, 1.5)
End Module
Module raiseToPower (Real value, Integer power)
Declare Real result
set result = value ^power
Display result
End Module
Programming Exercises
1. Kilometer Converter
Design a modular program that asks the user to enter a dist
then converts that distance to miles. The conversion formula
Miles
Kilometers X 0.6214
Page 10
Q
பி