Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Rectangle2D {
- public static void main(String[] agrs) {
- Scanner scan = new Scanner(System.in);
- double x1 = Double.parseDouble(scan.nextLine());
- double y1 = Double.parseDouble(scan.nextLine());
- double x2 = Double.parseDouble(scan.nextLine());
- double y2 = Double.parseDouble(scan.nextLine());
- double a = Math.max(x1, x2) - Math.min(x1, x2);
- double b = Math.max(y2, y1) - Math.min(y1, y2);
- double area = a * b;
- double perimeter = 2 * (a + b);
- System.out.println(area);
- System.out.println(perimeter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement