Skip to content

StudentsOnly/01-java-method-parameters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Exercise: Method Parameters

Objective:

Write a Java program that calculates the area and perimeter of a rectangle given its length and width. You should implement the following methods:

  1. A method to calculate the area of the rectangle, given the length and width.
  2. A method to calculate the perimeter of the rectangle, given the length and width.

Instructions:

  1. Create a new Java class and name it "RectangleCalculator".

  2. Define the class and add the main method inside it.

  3. Define two methods to calculate the area and perimeter of the rectangle. The methods should take two parameters, the length, and the width, and return the corresponding calculated values.

  4. Inside the main method, take input from the user for the length and width of the rectangle.

  5. Call the area and perimeter methods with the user-provided values and display the results.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages