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



Geometry Program


Description

This program uses several methods to calculate the rectangle and the right triangle's areas and perimeters, and calculate the circle's area and circumference.

It also demonstrates the concepts of global and local variables.

Associated Concepts:

Method

Global and local variables

Algorithm:

Declare and create keyboard as a global variable so it is available to all the methods in the program.

main method:

Declare local variables

Input data from the keyboard

Call methods and pass arguments to get the results

Print the results

Write method definitions

calRecArea

calRecPerimeter

calCirArea

calCirCumference

hypotenuse

calTriArea

calTriPerimeter

Source Code



Sample Run



Video