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
1. You are asked to write a report about one of the structures that Transportation Engineers
aksik [14]

Answer:

ddition, please state if transportation engineers are involved with any other ... Please specify their specific roles and contributions in the execution of the ...

8 0
3 years ago
An actual vapour compression system comprises following process represents a. 1-2 Compression process b. 2-3 Condens 1 (or heat
Gemiola [76]

Answer:

Explanation:

The deatailed diagram of VCRS is given below such

1-2=Isentropic compression in which temperature increases at constant entropy

2-3=Isobaric heat rejection i.e. heat rejected at constant pressure(condensation)

3-4=Irreversible expansion or throttling in which enthalpy remains constant

4-1=Isobaric heat addition(Evaporation)

4 0
3 years ago
Which of the following machine parts always require
Anna007 [38]

Answer:fan blades, rotating , abrasive wheel machinery

Explanation:

8 0
3 years ago
A heat engine operates between 2 reservoirs at TH and 18oC. The heat engine receives 17,000 kJ/h from the high temperature reser
lisabon 2012 [21]

Answer:

See explaination

Explanation:

Please kindly check attachment for the step by step solution of the given problem

4 0
3 years ago
HfrrghhJbfrfefefft nbgyjjiutrwdgju
Tasya [4]

Answer:

hshdhriwjajaldh skshdjdywuusg

Explanation:

null

4 0
3 years ago
Other questions:
  • How do i get my camera to work in the app, i just got a new phone and it won’t pull up the camera
    14·1 answer
  • The amount of time an activity can be delayed and yet not delay the project is termed:_________
    14·1 answer
  • A signalized intersection approach has three lanes with no exclusive left or right turning lanes. The approach has a 40-second g
    10·1 answer
  • To increase fault-tolerance, the security administrator for Corp has installed an active/passive firewall cluster where the seco
    11·1 answer
  • Can someone Please help me..? If I'm your Onii-San then answer. And get brainliest. Make sure to explain why..
    15·1 answer
  • List a minimum of four reasons why you might be rejected for a job offer.
    10·1 answer
  • Hey any one ride dirtbikes here
    5·2 answers
  • Is it permissible to install recessed fixture directly against wood ceiling joists? Explain why or why not.
    5·1 answer
  • 3. What is special about beryllium-copper alloy tools?
    6·2 answers
  • All these are returnless fuel systems EXCEPT ?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!