1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Arturiano [62]
3 years ago
11

For this question you must write a java class called Rectangle and a client class called RectangleClient. The partial Rectangle

class is given below. (For this assignment, you will have to submit 2 .java files: one for Rectangle class and the other one for RectangleClient class.) // A Rectangle stores an (x, y) coordinate of its top/left corner, its width and height. public class Rectangle { private int x; private int y; private int width; private int height; // constructs a new Rectangle with the given inX, inY and inSideLength public Rectangle(int inX, int inY, int inWidth, int inHeight) // returns the fields' values public int
Engineering
1 answer:
Alex Ar [27]3 years ago
6 0

Answer:

Java program is given below. You can get .class after you execute java programs, You can attach those files along with .java classes given , Those .class files are generated ones.

Explanation:

//Rectangle.java class

public class Rectangle {

private int x;

private int y;

private int width;

private int height;

// constructs a new Rectangle with the given x,y, width, and height

public Rectangle(int x, int y, int w, int h)

{

this.x=x;

this.y=y;

this.width=w;

this.height=h;

}

// returns the fields' values

public int getX()

{

return x;

}

public int getY()

{

return y;

}

public int getWidth()

{

return width;

}

public int getHeight()

{

return height;

}

// returns a string such as “Coordinate is (5,12) and dimension is 4x8” where 4 is width and 8 is height. public String toString()

public String toString()

{

String str="";

//add x coordidate , y-coordinate , width, height and area to str and return

str+="Coordinate is ("+x+","+y+")";

str+=" and dimension is : "+width+"x"+height;

str+=" Area is "+(width*height);

return str;

}

public void changeSize(int w,int h)

{

width=w;

height=h;

}

}

======================

//main.java

class Main {

public static void main(String[] args) {

//System.out.println("Hello world!");

//create an object of class Rectangle

Rectangle rect=new Rectangle(5,12,4,8);

//print info of rect using toString method

System.out.println(rect.toString());

//chamge width and height

rect.changeSize(3,10);

//print info of rect using toString method

System.out.println(rect.toString());

}

}

==========================================================================================

//Output

Coordinate is (5,12) and dimension is : 4x8 Area is 32

Coordinate is (5,12) and dimension is : 3x10 Area is 30

========================================================================================

You might be interested in
For each topic, find the total number of blurts that were analyzed as being related to the topic. Order the result by topic id.
photoshop1234 [79]

Answer:

Explanation: see attachment below

8 0
3 years ago
What are the benefits of using the engineering design process? combining scientific knowledge and creativity in a rigid and stru
Trava [24]

Answer:

combining scientific knowledge, careful reasoning, and artistic invention in a flexible approach to problem-solving

Explanation:

7 0
3 years ago
As project manager, you approve a team member’s request to change the order of their tasks because they think it will be more ef
Oduvanchick [21]

The project is going to scope if the situation happens. Option A is correct.

<h3 /><h3>What is the function of a project manager?</h3>

Project managers are in charge of organizing, planning, and guiding the execution of certain projects for an organization .

As the project manager, you grant a team member's request to rearrange their work in a way they believe will increase productivity.

However, this modification interferes with another team member's workflow since they now have to complete two more activities that are unrelated to the project's objective. The project will be within its scope.

Hence option A is correct.

To learn more about the project manager refer;

brainly.com/question/15404120

#SPJ1

6 0
2 years ago
If you are unsure about holding a piece of wood to be drilled, then you should always use a
alisha [4.7K]
C I took construction class
4 0
3 years ago
B)
Triss [41]

Answer:

2.5 is the required details

8 0
3 years ago
Other questions:
  • 9 b. A sign (including the post and base) weighs 40 pounds and is
    8·1 answer
  • Memory Question!
    7·1 answer
  • A circuit with ____ -diameter connecting wires at a _____ temperature will have the least electrical resistance.
    13·1 answer
  • In addition to bandages and gauze, it's recommended that a first aid kit also contain ___________. A) A finger splintB) Portable
    9·1 answer
  • What is Back EMF? How does it limits the speed of a permanent magnet DC?
    10·1 answer
  • Which type of load is not resisted by a pinned joint? A) Moment B) Shear C) Axial D) Compression
    7·1 answer
  • If a shear stress acts in one plane of an element, there must be an equal and opposite shear stress acting on a plane that is
    15·2 answers
  • Sort the following alphabets using MergeSort and give required steps. [2 Marks]
    9·1 answer
  • Dangerous of overloading in a circuit,​
    6·1 answer
  • You can help build a safe work environment by using your knowledge of violence prevention strategies to spot what?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!