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