The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
d
Part 1 - Review the following pseudo code and answer the question below.
|
void main() Integer num = 0 printWelcome () num = num + 1 printAnswer(num) num = num + 1 printAnswer() printClosingMessage() end module void printAnswer(Integer answer) output “The answer is “ + answer end module void printWelcomeMessage() String welcome = “Welcome to my program” output welcome end module void printClosingMessage() output “Thank you for using my program” end module output “Thank you for using my program” |
Part 1 Questions:
What are the problems with this code? Mark each line that is a problem and make corrections to fix the problem. You may need to strike through code, change code, or add code.Mark each line of code above where module calls are made.Are there any parameters in this code? If so, complete the table:
|
Parameter Name |
Data Type |
Scope - Module |
Corresponding Argument |
Are there any local variables in this code? If so, complete the table:
|
Local Variable Name |
Data Type |
Scope – Module |
Part 2 - Review the following pseudo code and answer the question below.
|
void main() Real celsius = 0.0 Real fahrenheit = 0.0 fahrenheit = celsiusTofahrenheit(celsius) output “The Fahrenheit is “ + Fahrenheit displayClosingMessage() end module void displayWelcomeMessage() output “Welcome to my program” end module void displayClosingMessage() output “” output “Thank you for using my program” end module Real celsiusToFahrenheit(Real cTemp) Real fTemp fTemp = (cTemp * (9 / 5)) + 32 return fTemp end module Real fahrenheitToCelsius(Real fTemp) Real cTemp cTemp = (fTemp – 32) * (5 / 9) return cTemp end module |
Part 2 Questions:
You can assume that there are no problems in the pseudo code above.
|
Parameter Name |
Data Type |
Scope - Module |
Corresponding Argument |
|
Local Variable Name |
Data Type |
Scope - Module |
Homework Assignment #4 – Questions about Modules in Pseudo Code
Part 1 - Review the following pseudo code and answer the question below.
void main()
Integer num = 0
printWelcome ()
num = num + 1
printAnswer(num)
num = num + 1
printAnswer()
printClosingMessage()
end module
void printAnswer(Integer answer)
output “The answer is “ + answer
end module
void printWelcomeMessage()
String welcome = “Welcome to my program”
output welcome
end module
void printClosingMessage()
output “Thank you for using my program”
end module
output “Thank you for using my program” Part 1 Questions:
1. What are the problems with this code? Mark each line that is a problem and make corrections to fix the
problem. You may need to strike through code, change code, or add code. 2. Mark each line of code above where module calls are made. 3. Are there any parameters in this code? If so, complete the table: Parameter Name 4. Data Type Scope - Module Corresponding Argument Are there any local variables in this code? If so, complete the table:
Local Variable Name Data Type Scope – Module Part 2 - Review the following pseudo code and answer the question below.
void main()
Real celsius = 0.0
Real fahrenheit = 0.0
fahrenheit = celsiusTofahrenheit(celsius)
output “The Fahrenheit is “ + Fahrenheit
displayClosingMessage()
end module
void displayWelcomeMessage()
output “Welcome to my program”
end module
void displayClosingMessage()
output “”
output “Thank you for using my program”
end module
Real celsiusToFahrenheit(Real cTemp)
Real fTemp
fTemp = (cTemp * (9 / 5)) + 32
return fTemp
end module
Real fahrenheitToCelsius(Real fTemp)
Real cTemp
cTemp = (fTemp – 32) * (5 / 9)
return cTemp
end module Part 2 Questions:
You can assume that there are no problems in the pseudo code above.
5. Mark each line of code above where module calls are made.
6. Are there any parameters in this code? If so, complete the table:
Parameter Name
Data Type
Scope - Module 7. 8. Are there any local variables in this code? If so, complete the table:
Local Variable Name
Data Type What is the output from the program? Corresponding Argument Scope - Module
Attachments:
-----------