home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh18 / CH18LIST / Classes / SimpleMath.uc < prev   
Encoding:
Text File  |  2006-02-21  |  1.3 KB  |  51 lines

  1. // %PARAMETERS = "CH18LIST C:\UT2004"
  2. //Identifies the package
  3. //SimpleMath.uc
  4.  
  5. //This class provides math functions useful for working with basic math
  6. class SimpleMath extends Commandlet;
  7.  
  8. //#1
  9. //-------------- addNums ----------------------------
  10. public function int addNums(int A, int B){
  11.   return A + B;
  12. }
  13. //--------------subtractNums--------------------------
  14. public function int subtractNums(int A, int B){
  15.   return A - B;
  16. }
  17. //-------------- multiplyNums ------------------------
  18. public function int multiplyNums(int A, int B){
  19.   return A * B;
  20. }
  21. //-------------- divideNums --------------------------
  22. public function float divideNums(float A, float B){
  23.     return B / A;
  24. }
  25. //-------------- makeCaps ----------------------------
  26. //#2
  27. public function string makeCaps(string exp){
  28.         return Caps(exp);
  29. }
  30. //-------------- joinWords ---------------------------
  31. public function string joinWords(string expA,
  32.                                  string expB){
  33.         return expA $ expB;
  34. }
  35. //-------------- getCircumference --------------------
  36. //#3
  37. public function float getCircumference(float diameter){
  38.     return (Pi * diameter);
  39. }
  40. //-------------- getArea -----------------------------
  41. public function float getArea(float radius){
  42.     return (Pi * Square(radius) );
  43. }
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.