Please adjust the code from my professor's feedback:
Your class looks good accept for the return. For example, functions should look like this:Public Function GetTotal() As Float Set GetTotal = TotalEnd FunctionYour declarations are missing the "As"Use != instead of NOT EQUALSThank you,
Declarations are still missing the "As"
Some more critiques from my professor
Class:-You need to add the constructor to set the default for the variables.Main:-You have not told the user how to exit-You need input statements to get data from the user-Give the user more information about what the program is doing, like this:Declare Worker1 As WorkerDeclare HoursWorked As FloatDeclare PayRate As FloatWrite "Enter an employee's hours worked and hourly pay rate"Write "and this program will compute his or her total wages."Write "To quit, enter 0 for both hours worked and pay rate."Write "Enter the number of hours worked:"Input HoursWorkedWrite "Enter the employee's rate of pay:"Input PayRateWhile (HoursWorked != 0) AND (PayRate != 0) Call Worker1.SetHours(HoursWorked) : : :End While
Have you had a chance to make the corrections?
Still needs a little work:
Getting there.-Your constructor is not declared properly ... see page 455, lines 5-8-You still need to replace "Get count" with an input statement
The example constructor that he is referencing is:
Set Side = 1.0
Set Volume = 1.0
I think that the statement Get Count needs to replaced with Input Count
The code still needs to have the following corrected:
We use Float, not Double.
You are getting attributes before they are set.
You should have the user input the hours and rate before the while loop.
Like this:Write "Enter the number of hours worked:"Input HoursWorkedWrite "Enter the employee's rate of pay:"Input PayRate
Remove the methods from the while loop since the attributes have not been setWhile (HoursWorked != 0) AND (PayRate != 0)
I removed the second constructor and edited the syntax according to his suggestions below, then resubmitted the code thinking that would be the final editing needed. Then he sent back the feedback above.
You have two constructors declared ... remove one
Make sure you syntax is consistent. Review your code for proper capitalization
I need a corrected version ASAP. When can I expect this?
Thank you for working with me.
Private Declare Hours As Integer Private Declare Rate As Double Private Declare Total As Double
Public worker() Set Hours = 0 Set Rate = 0.0 Set Total = 0.0 End Constructor
Public Function ComputeTotal() Set Total = Hours * Rate End Function
Public Function SetHours(hr) Set Hours = hr End Function
Public Function SetRate(rt) Set Rate = rt End Function
Public Function SetTotal(ttl) Set Total = ttl End Function
Public Function GetHours() Set GetHours = Hours End Function
Public Function GetRate() Set GetRate = Rate End Function
Public Function GetTotal() Set GetTotal = Total End Function
Declare WRKR As Worker Declare hrs As Integer Declare rte As Double
Write "The program will compute Employee's total wages based on User input of hours worked and hourly pay rate."
DO While ((WRKR.GetHours() != 0) AND (WRKR.GetRate() != 0)) Write "Enter Number of Hours Worked or 0 to exit : " Input hrs Call WRKR.setHours(hrs) Write "Enter Rate per Hour Worked or 0 to exit : " Input rte Call WRKR.setRate(rte) Call WRKR.ComputeTotal()
If((WRKR.GetHours() != 0) AND (WRKR.GetRate() != 0)), Then Write "Number of Hours Worked : " + WRKR.GetHours() + " Hours." Write "Rate per Hour : $" + WRKR.GetRate() Write "Total Money Earned by Worker : $" + WRKR.GetTotal() End If End While
End Main Method