0

I keep getting Fatal error: Call to undefined function newMyOperatorClass() in C:\wamp\www\KanJ_PHP_Website\KanJ_PHP_Ex2.php on line 17.....here is my code...

<html>
    <head>
        <title>Justin Kangley Ex2</title>
    </head>

    <body>
        <?php

        class MyOperatorClass
        {
            private $rValue; //declare private property at the class level so all the functions use it

            //default constructor method (same name as class but no parameters/values passed to the method)
            public function MyOperatorClass()
            {
                //this is the PHP approach to setting class properties
                $this->rValue = 0.0;
            }

            public function add($num1, $num2)
            {
                $rValue = $num1 + $num2;
                return $rValue;
            }

            public function subtract($num1, $num2)
            {
                $rValue = $num1 - $num2;
                return $rValue;
            }

            public function multiply($num1, $num2)
            {
                $rValue = $num1 * $num2;
                return $rValue;
            }

            public function divide($sum1, $sum2)
            {
                $rValue = $sum1 / $sum2;
                return $rValue;
            }

            public function modulus($sum1, $sum2)
            {
                $rValue = $sum1 % $sum2;
                return $rValue;
            }

            public function increment($sum1)
            {
                $sum++;
                return $sum1;
            }

            public function decrement($sum1)
            {
                $sum1--;
                return $sum1;
            }
        }

        ?>
    </body>

</html>

Edited by GingerDontCare

1
Contributor
1
Reply
8
Views
3 Years
Discussion Span
Last Post by GingerDontCare
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.