java program to calculate area of rectangle

Solutions on MaxInterview for java program to calculate area of rectangle by the best coders in the world

showing results for - "java program to calculate area of rectangle"
Alessandro
13 Jan 2017
1// calculate area of rectangle using class in java
2import java.io.*;
3class RectangleShape 
4{
5   int length, breadth; 
6   void setValue(int l, int b) 
7   { 
8       length = l; 
9       breadth = b; 
10   }
11   // get area of rectangle
12   int findArea() 
13   { 
14       return (length * breadth); 
15   }
16}
17public class RectangleAreaDemo
18{
19   public static void main(String[] args)
20   {
21      RectangleJava obj = new RectangleJava(); 
22      obj.setValue(10, 5); 
23      System.out.println("Area of rectangle: " + obj.findArea());
24   }
25}
Charlie
11 Jan 2020
1import java.util.Scanner;
2public class RectangleArea
3{
4   public static void main(String[] args)
5   {
6      Scanner sc = new Scanner(System.in);
7      System.out.println("Please enter length of rectangle: ");
8      double length = sc.nextDouble();
9      System.out.println("Please enter width of rectangle: ");
10      double width = sc.nextDouble();
11      double area = length * width;
12      System.out.println("Area of rectangle is: " + area);
13      sc.close();
14   }
15}
queries leading to this page
area rectangle javaarea of rectangle formula in javahow to claculate area of rectangle javacalculate the area of a rectangle methode jvaprogramme that calculate rectangle area java using class and objectshow rectangle info 28 29 javacalculate area java programhow to calculate the area of a rectangle in javajava method that calculates area of rectanglejava program to calculate the area of a rectanglewrite a program to find area of rectangle in javajava program to calculate area of rectanglecalculate the area of rectangle in c 2b 2bjava program for area of rectanglejava program to find area of rectangle using functioncalculate area of rectangle and triangle in javafind area of rectangle in javajava program to find area of rectangle using method overloadinghow to find area of rectangle using function in javausing the following information to write java program to calculate the area of rectrectangle width formula javacalculate area of rectangle in java using class and objectwrite a program using interface to calculate area of rectangle calculate the area of a rectangle using method javawrite a program to find the area of rectangle in javaarea of field java programwrite a program to calculate area of rectangle in javajava program to find the area of rectangle using class and objectarea of rectangle in javahow to measure acres in javasimple java program for area of rectanglewrite a program in java with rectangle with the data fields white plains and area colour length white and areacreate an application using java that prompots the user for the length width and height of a rectangular roomhow to calculate rectangle area in java using class and objectcalculate area of rectangle using class in javawrite a java program to calculate and display the area of a rectangle withfind area in javcjava program which intakes width and height of a rectangle and there by print its areaarea of rectangle by using class and object in javaobjects and classes area of a rectangle javarectangle area javarectangle area formula javahow to make a program on java to calculate the area of a rectanglecalculate the area of rectangle given lenth and width javajava program to find area of rectanglearea of rectangle program in javahow to find area of rectangle in javaarea of a rectanglearea of rectangle in java programarea of rectangle in java using methodcode to find out the area of rectangle by using classes and objects in javahow to calculate rectangle area in javaarea of rectangle javafind area of rectangle using four point in javasimple code find the area of rectangle in javajava calc areajava program to calculate area of rectangle