calculate area of rectangle using class in java

Solutions on MaxInterview for calculate area of rectangle using class in java by the best coders in the world

showing results for - "calculate area of rectangle using class in java"
Asma
03 Jan 2021
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}
Claudio
08 Mar 2019
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 of field java programarea of rectangle by using class and object in javawrite a program to find the area of rectangle in javacalculate the area of a rectangle using method javarectangle area javajava program to find area of rectangleprogramme that calculate rectangle area java using class and objectarea of rectangle program in javajava program to calculate area of rectanglefind area of rectangle using four point in javahow to measure acres in javahow to find area of rectangle in javaobjects and classes area of a rectangle javasimple code find the area of rectangle in javahow to calculate rectangle area in javahow to make a program on java to calculate the area of a rectanglewrite a program to find area of rectangle in javashow rectangle info 28 29 javacalculate the area of rectangle in c 2b 2bcalculate area java programcalculate area of rectangle and triangle in javajava method that calculates area of rectanglejava program to find area of rectangle using method overloadingarea of rectangle in javaarea rectangle javajava calc areacode to find out the area of rectangle by using classes and objects in javajava program to find the area of rectangle using class and objectfind area of rectangle in javafind area in javcarea of rectangle formula in javawrite a program to calculate area of rectangle in javajava program for area of rectanglehow to calculate the area of a rectangle in javarectangle width formula javahow to claculate area of rectangle javajava program to find area of rectangle using functionsimple java program for area of rectanglearea of rectangle in java using methodcalculate the area of rectangle given lenth and width javawrite a program in java with rectangle with the data fields white plains and area colour length white and areajava program to calculate the area of a rectanglearea of a rectanglehow to find area of rectangle using function in javacalculate area of rectangle in java using class and objectusing the following information to write java program to calculate the area of rectcalculate area of rectangle using class in javaarea of rectangle javahow to calculate rectangle area in java using class and objectwrite a program using interface to calculate area of rectangle create an application using java that prompots the user for the length width and height of a rectangular roomwrite a java program to calculate and display the area of a rectangle withrectangle area formula javajava program which intakes width and height of a rectangle and there by print its areaarea of rectangle in java programcalculate the area of a rectangle methode jvacalculate area of rectangle using class in java