Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help debugging this code. please explain what is wrong with it step by st

ID: 3743794 • Letter: I

Question



I need help debugging this code. please explain what is wrong with it step by step

// This pseudocode segment is intended to display // employee net pay values. All employees have a standard // $45 deduction from their checks. // If an employee does not earn enough to cover the deduction, // an error message is displayed. start Declarations string name num hours num rate num DEDUCTION = 45 string EOFNAME "Z2Z" num net output "Enter first name or ", ROFNAME, "to quit" input name while name equal to EOFNAME output "Enter hours worked for ", name input hours output "Enter hourly rate for name gross hours * rate net -grssDEDUCTION while net > 0 then output "Net pay for ", name, is ", net else output "Employee did not make enough to cover deductions, Net is output "Enter next name or ", BOFNAME, " to quit" input name output "End of Job" endwhi le stop

Explanation / Answer

start // the procedure will be started

declarations // number of variables will be declared here

string name // name is a variable of type string

num hours //hours is a variable of type number

num rate //rate is a variable of type number

num DEDUCTION=45 //DEDUCTION is a variable of type number and assigned the value 45

string EOFNAME="zzz" // EOFNAME is a variable of type string and assigned the string "zzz"

num net  //net is a variable of type number

output "enter first name or",EOFNAME, "to quit" //asking to enter name

input name //reading the name

while name equal to EOFNAME // checking whether name and EOFNAME are equal or not. NOTE: instead you can write it as name=EOFNAME

output "enter hours worked for", name // entering number of hours that person worked

input hours

output "enter hourly rate for", name // for each hour you are entering rate for that person

gross=hours*rate // calculating total gross. NOTE: you missed input rate above this line

net=gross-DEDUCTION // calculating net pay

while net>0 then //checking whether net > 0 or not. NOTE: while must be replaced with if

output "net pay for", name, "is",net // message will be printed in output screen

else

output "employee did not make enough to cover deductions, net is 0"

// NOTE: if must be ended here. i.e. endif

output "enter next name of",EOFNAME,"to quit" // asked to repeate process ot terminate

input name // reading name

output "end job" // message will be printed

endwhile // while loop is ended here

stop // procedure stoped here.

make changes in the code where i marked as NOTE. It will be worked.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote