Question: using java Write a Java class called Rectangle that represents a rectangular two-dimensional region. Your Rectangle objects should have following methods: public void sctFields(int newx,
Write a Java class called Rectangle that represents a rectangular two-dimensional region. Your Rectangle objects should have following methods: public void sctFields(int newx, int newy, int newwidth, int newbeight) Set the values for the fields in the Rectangle objects whose top-left comer is specified by the given x and y coordinates and by the width and height. public int getHeight0 the Rectangle's height. public int getWidth0 Returns the Rectangle's width. public int getx0 Returns the Rectangle's x-coordinate public int getYO Returns the Rectangle's y-coordinate public String toString) Retums a String representation of this Rectangle, such as "Rectangle [x-2, y-13, height-14, width-s1" Write a client program called RectangleClient that creates objects of the Rectangle class called rectl and rect2. Assign values to the fields of these objects. Print out these Rectangle objects using System.out.printin0 method. MacBook Air 20 F8 19 F10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
