Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Lab6CalculateRectangleArea {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double width = Double.parseDouble(scanner.nextLine());
- double length = Double.parseDouble(scanner.nextLine());
- double area = getRectangleArea(width, length);
- System.out.printf("%.0f",area);
- }
- private static double getRectangleArea(double width, double length) {
- return width * length;
- }
- }
- //Create a method that calculates and returns the area of a rectangle by given width and length.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement