COMP2243 - Programming and Problem Solving

Syllabus Software Installation Assignments Tests
Lectures and Labs
**Back to Full Menu**

Methods RightTriangle.java RightTriangleWithLoop.java Geometry.java PayrollWithMethod.java PayrollWithMethodLoop.java Palindrome.java GlobalAndLocal.java Overloading.java Overloading2.java MathMethods.java and MathProgram.java CaesarCipher.java



MathMethods Program


Description

MathMethods.java file contains factorial, fibonacci, prime, hypotenuse, and perfect number methods.

It doesn't have the main() method, so it cannot be run as a program. But the methods can be called by other programs.

MathProgram.java is a program that calls the methods defined in MathMethods.java file.

***Note: Both source code files should be placed in the same directory.

Associated Concepts:

Calling methods defined in other Java file

Algorithm:

MathMethods.java file contains several methods.

hypotenuse

factorial

fibonacci

prime

perfectNnumber

MathProgram.java calls the methods defined in MathMethods.java file.

Source Code

MathMethods.java Source Code



MathProgram.java Source Code



Sample Run



Video