-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArea.java
More file actions
38 lines (34 loc) · 1.04 KB
/
Area.java
File metadata and controls
38 lines (34 loc) · 1.04 KB
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
28
29
30
31
32
33
34
35
36
37
38
import java.util.Scanner;
public class Area{
/*
* main method with args as parameters
*/
public static void main(String args[]){
double length, width, area;
Scanner userinput;
/*
* Input object
*/
userinput = new Scanner(System.in);
/*
* Request user to enter length of the rectangle
*/
System.out.print("\n Enter length: "); length = userinput.nextDouble();
/*
* Request user to enter width of the rectangle
*/
System.out.print("\n Enter width:");width = userinput.nextDouble();
/*
* Compute area
*/
area = length * width;
/*
* Print area
*/
System.out.println(area);
/*
* continue ?
*/
System.exit(0);
}
}