forked from cs-dept-ibbul/java2019
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab4Rectangledemo.java
More file actions
21 lines (19 loc) · 935 Bytes
/
Copy pathLab4Rectangledemo.java
File metadata and controls
21 lines (19 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.Scanner;
public class RectangleDemo
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Please Enter the Length: ");
double l = input.nextDouble();
System.out.println("Please Enter the Width: ");
double w = input.nextDouble();
Rectangle rectangle = new Rectangle(l,w);
System.out.println("The Area is : " + rectangle.area() + " square cm");
System.out.println("The Length of the Rectangle is : " + rectangle.getLength() + " cm");
System.out.println("Please enter the new Length of the Rectangle");
rectangle.setLength(input.nextDouble());
System.out.println("The new Length of the Rectangle is : " + rectangle.getLength() + " cm");
System.out.println("The new Area of the Rectangle is: " + rectangle.area());
}
}