Cambridge10
Programmer
I've just started to work with Php 5 OO.
function totalVehicleWeight calculates the total weight of the vehicle. It return that to the screen of the user.
function diffFrontRear calculates the diff of the front and rear but it's also need the input of function totalVehicleWeight.
How should I call function totalVehicleWeight within function diffFrontRear?
The code:
<?php
class Calculate
{
private $lfweight;
private $rfweight;
private $lrweight;
private $rrweight;
private $result;
function totalVehicleWeight($lfweight,$rfweight,$lrweight,$rrweight)
{
return $this->result=($lfweight+$rfweight+$lrweight+$rrweight);
}
function diffFrontRear($lfweight,$rfweight)
{
return $this->result=(($lfweight+$rfweight)/(result of function totalVehicleWeight/100));
}
?>
function totalVehicleWeight calculates the total weight of the vehicle. It return that to the screen of the user.
function diffFrontRear calculates the diff of the front and rear but it's also need the input of function totalVehicleWeight.
How should I call function totalVehicleWeight within function diffFrontRear?
The code:
<?php
class Calculate
{
private $lfweight;
private $rfweight;
private $lrweight;
private $rrweight;
private $result;
function totalVehicleWeight($lfweight,$rfweight,$lrweight,$rrweight)
{
return $this->result=($lfweight+$rfweight+$lrweight+$rrweight);
}
function diffFrontRear($lfweight,$rfweight)
{
return $this->result=(($lfweight+$rfweight)/(result of function totalVehicleWeight/100));
}
?>