daily pastebin goal
96%
SHARE
TWEET

Untitled

a guest Mar 21st, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class CircleAreaAndPerimeter {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double x1 = Double.parseDouble(scanner.nextLine());
  8.         double y1 = Double.parseDouble(scanner.nextLine());
  9.         double x2 = Double.parseDouble(scanner.nextLine());
  10.         double y2 = Double.parseDouble(scanner.nextLine());
  11.  
  12.         double a = Math.abs(x1 - x2);
  13.         double b = Math.abs(y1 - y2);
  14.  
  15.         double s = a * b;
  16.         double p = 2 * (a + b);
  17.  
  18.         System.out.printf("%.2f\n%.2f", s, p);
  19.  
  20.  
  21.  
  22. }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top