Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please I wrote this in paeudocode and I need help translating it to java please Class Employee Private Real payRate Private Real hoursWorked Private Real
Please I wrote this in paeudocode and I need help translating it to java please
Class Employee
Private Real payRate
Private Real hoursWorked
Private Real grossPay
Public Module Employee ( )
Set payRate = 0.0
Set hoursWorked = 0.0
Set grossPay = 0.0
End Module
Public Function Real getPayRate ( )
Return payRate
End Function
Public Function Real getHoursWorked ( )
Return hoursWorked
End Function
Public Function Real getGrossPay ( )
Return grossPay
End Function
Public Module setPayRate (Real newPayRate)
If newPayRate > 0 Then
Set payRate = newPayRate
Else
Display newPayRate, " is not a valid pay rate."
Set payRate = 0
End If
End Module
Public Module setHoursWorked (Real newHoursWorked)
If newHoursWorked > 0 Then
Set hoursWorked = newHoursWorked
Else
Display newHoursWorked, " is not a valid value for hours worked."
Set hoursWorked = 0
End If
End Module
Public Module computeGrossPay ( )
Set grossPay = payRate * hoursWorked
Display "Gross pay is", grossPay
End Module
End Class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started