Computer Science, asked by sneha413639, 4 months ago

Write to class a rectangle len and bre in decimal . Define a method void showArea( ) to compute thr area of rectangle and print it . Define another method void Runme( ) to create two object and initialise each instance variable with different values and by calling thr method showArea( ) .Print the area of rectangle for all value .​

Answers

Answered by Anonymous
3

Answer:

YOUR ANSWER IS IN THE ATTACHMENT..

Attachments:
Answered by Oreki
2

public class Rectangle {

double len, bre;

void showArea( ) {

System.out.println("Area - " + (len * bre));

}

void runMe( ) {

Rectangle rectangleOne = new Rectangle( ),

rectangleTwo = new Rectangle( );

rectangleOne.len = 50;

rectangleOne.bre = 40;

rectangleOne.showArea( );

rectangleTwo.len = 45.09;

rectangleTwo.bre = 60.87;

rectangleTwo.showArea( );

}

}

Similar questions