Tiger6117

Area and Perimeter of the Rectangle

Dec 2nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. public class Rectangle {
  2.  
  3.    public static void main(String[] strings) {
  4.  
  5.         final double width = 5.6;
  6.         final double height = 8.5;
  7.  
  8.         double perimeter = 2*(height + width);
  9.        
  10.         double area = width * height;          
  11.        
  12.         System.out.printf("Perimeter is 2*(%.1f + %.1f) = %.2f \n", height, width, perimeter);
  13.  
  14.         System.out.printf("Area is %.1f * %.1f = %.2f \n", height, width, area);
  15.     }
  16. }
Add Comment
Please, Sign In to add comment