home *** CD-ROM | disk | FTP | other *** search
- //========================================================
- // Math.
- //see Math.txt
- //========================================================
- class Math extends Actor placeable;
-
-
- // #1 Takes two arguments of the type float
- // and returns a value of the type float
- public function float Add(float NumA, float Numb){
- return NumA + NumB;
- }
-
- public function float Subtract(float NumA, float NumB){
- return NumA - NumB;
- }
-
- public function float Multiply(float NumA, float Numb){
-
- return NumA * NumB;
- }
-
- public function float DivideAbyB(float NumA, float Numb){
-
- // #2 Declare a variable that is not
- // visible to other functions
- local float Result;
- Result = 0;
- if(NumA != 0){
- Result = NumA/NumB;
- }
- return Result;
- }
-
-
- public function float AverageTwoNumbers(float First, float Second){
-
- local float ResultingNumber;
-
-
- //#3 Call add from within the class
- //Assign the returned value of Add()
- ResultingNumber = Add(First, Second);
-
- //#4 When you assign a new value, you clear the old
- ResultingNumber = DivideAbyB(ResultingNumber, 2.0);
- return ResultingNumber;
- }
-
- defaultproperties
- {
- }
-