乘以两个属性

I need to figure out how to calculate a workers weekly earning. I need to do so by using a getWeeklyEarnings method, but cannot figure out how to multiply the two attributes wage and hours.

My questions are what would the code be in the class.php and how would I call it in the object. Any advice would be amazing, Thank You!

Attached will be my code thus far. My Class

Like what hanky-웃-panky said above, but make the function public instead.

public function getWeeklyEarnings()
{
    return $this->hours * $this->wage;
}

That way, you can call it in your provided code like:

echo "Weekly Earnings: $" . $w1->getWeeklyEarnings();

Alternatively, if you cannot edit hourly_worker.class.php, but can access the hours and wage of that class, then you could probably do something like:

echo "Weekly Earnings: $" . $w1->hours * $w1->wage;