Didart

Calculate Rectangle Area

Oct 7th, 2021
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CalculateRectangleArea {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double width = Double.parseDouble(scanner.nextLine());
  8.         double length = Double.parseDouble(scanner.nextLine());
  9.  
  10.         double area = calculateRectangleArea(width, length);
  11.  
  12.         System.out.printf("%.0f", area);
  13.     }
  14.  
  15.     public static double calculateRectangleArea(double width, double length) {
  16.         return width * length;
  17.     }
  18. }
  19.  
  20.  
  21.  
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment