Write a program that inputs (from the user) the number of hours worked and hourl
ID: 3566767 • Letter: W
Question
Write a program that inputs (from the user) the number of hours worked and hourly pay rate for employees and outputs their total pay. The program should process an arbitrary number of employees; the user will terminate input by entering 0 for hours worked and pay rate. Use a class called Worker with Attributes: Hours, Rate, Total Methods: ComputerTotal(), and access methods (SetHours(), GetHours(), SetRate(), GetRate(), SetTotal(), and getTotal()) for each of the attributes. Draw a FLOWCHART and write a pseudocode for a python 3 program.I need both pseudocode and FLOWCHART please.
Explanation / Answer
Class Worker
float Hours
float Rate
float Total
Worker()
Rate=0
Total=0
Hours=0
SetHours (h)
Hours=h
GetHours ()
return Hours
SetRate (r)
Rate=r
GetRate ()
Return Rate
SetTotal (t)
Total = t
GetTotal ()
Return Total
ComputeTotal()
Total=Hours*RateThen
After worker class is defined you need to create another user class that will use the worker class and take inputs from user.
Something like:
class workerTester
Worker w=new Worker()
float h,r
int i=0;
Display 'Enter hourly pay rate(Press 0 when done):'
input rDisplay 'Enter hours worked(Press 0 when done):'
input h
do
add 1 to i
w.setRate(r)
w.setHours(h)
w.ComputeTotal()
Display ' For worker i :' ,i
Display 'Hours worked:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.