Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class called rectangle that creates and processes rectangular objects. Plz use simple Java language(BLUEJ is preferred) thank you! 6. [after 7.10-easy] Rectangles :

Write a class called rectangle that creates and processes rectangular objects. Plz use simple Java language(BLUEJ is preferred) thank you! image text in transcribed
6. [after 7.10-easy] Rectangles : Write a class called Rectangle that creates and processes rectangular objects. Include a class variable that holds the total number of rectangles and instance variables for height and width. a constructor that creates a new rectangle with a given height and width. Provide methods that return the total number of rectangles, increase the height of a calling rectangle, increase the calling rectangle, and print the area of a calling rectangle. Include this main method rovide width of a public static void main(String args) Rectangle r1 = new Rectangle(); r1.printArea () Rectangle r2 new Rectangle (2, 4) r2.printArea) r2.addHeight (3) addWidth (3) r2.printArea) System.out.println( Total number of rectanglesRectangle.getNumofRectangles)) ) I/ end main With this main method your program should generate the following output: Sample session Rectangle's area = 0 Rectangle's area = 8 Rectangle's area 35 Total number of rectangles = 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions