Computer Science, asked by lavisharma123456, 6 months ago

Define a method void Area () in a class rectangle, which takes two float type arguments for length and breadth ; then, calculate and return the area of the rectangle.​

Answers

Answered by StrankraDeolay
1

Answer:

O hello...... Hang on bro....

Note that the function has 'void' return type i.e; it will not return any value.

Explanation :

For returning the area :-

########

class Rectangle

{

float Area( float l, float b)

{

float areaaa = l * b;

return ( areaaa) ;

}

public static void main (String args [ ] )

{

float R = areaa( 17.6f, 52.f) ; System.out.println("the area of the rectangle = " +

R) ;

} // Main function closed

} // class closed

Hope it's helpful for you

Have a great day ahead

Similar questions