-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab2Activitytwo.java
More file actions
27 lines (21 loc) · 836 Bytes
/
Lab2Activitytwo.java
File metadata and controls
27 lines (21 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Scanner;
public class Lab2Activitytwo {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int width;
int length;
int area;
int perimeter;
System.out.print("Enter the length: ");
length = console.nextInt();
System.out.print("length you entered is "+length);
System.out.print("Enter the width: ");
width = console.nextInt();
System.out.print("Width you entered is "+width);
area = length * width;
System.out.println("Area = " + area);
perimeter = 2 * (length + width);
System.out.println("Perimeter = " + perimeter);
System.out.println();
}
}