Advertisement
veronikaaa86

06. Calculate Rectangle Area

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