Variables Review Doc
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class RectangleArea {
|
||||
public RectangleArea() {}
|
||||
|
||||
public void display() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.print("Length of the rectangle:");
|
||||
int length = scanner.nextInt();
|
||||
System.out.print("Width of the rectangle:");
|
||||
int width = scanner.nextInt();
|
||||
|
||||
System.out.printf("The area of the rectangle is: %d", length*width);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
RectangleArea r = new RectangleArea();
|
||||
r.display();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user