Examine the pseudocode that follows the introductory comment, then find and corr
ID: 3766481 • Letter: E
Question
Examine the pseudocode that follows the introductory comment, then find and correct all the bugs.
You are looking for "about" 3 Errors.
// Program gives user a 10% raise
start
Declarations
num payRate
num RAISE_FACTOR = 0.10
displayInstructions()
input payRate
newPay = payRate + payRate * RAISE_FACTOR
output "Your new pay rate will be ", newPay
stop
void showInstructions()
output "Enter your current pay rate"
output "in dollars and cents"
output "Do not use a dollar sign - "
output "Use digits and a decimal point only"
return newPay
Explanation / Answer
Answer:
// Program gives user a 10% raise
start
Declarations
num payRate
//num RAISE_FACTOR = 0.10// decimal values must be represented in double datatype--->3
double RAISE_FACTOR = 0.10
//displayInstructions() //function name wrong------------------>1
showInstructions() //correct
input payRate
newPay = payRate + payRate * RAISE_FACTOR
output "Your new pay rate will be ", newPay
stop
//void showInstructions() //return statement has been written below the code so return type must be int---------------------------------->2
int showInstructions()
output "Enter your current pay rate"
output "in dollars and cents"
output "Do not use a dollar sign - "
output "Use digits and a decimal point only"
return newPay
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.