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
Consider a 2-shell-passes and 8-tube-passes shell-and-tube heat exchanger. What is the primary reason for using many tube passes
Maru [420]

Answer:

See explanation

Explanation:

Solution:-

- The shell and tube heat exchanger are designated by the order of tube and shell passes.

- A single tube pass: The fluid enters from inlet, exchange of heat, the fluid exits.

- A multiple tube pass: The fluid enters from inlet, exchange of heat, U bend of the fluid, exchange of heat, .... ( nth order of pass ), and then exits.

- By increasing the number of passes we have increased the "retention time" of a specific volume of tube fluid; hence, providing sufficient time for the fluid to exchange heat with the shell fluid.

- By making more U-turns we are allowing greater length for the fluid flow to develop with " constriction and turns " into turbulence. This turbulence usually at the final passes allows mixing of fluid and increases the heat transfer coefficient by:

                                U ∝ v^( 0.8 )    .... ( turbulence )

- The higher the velocity of the fluids the greater the heat transfer coefficient. The increase in the heat transfer coefficient will allow less heat energy carried by either of the fluids to be wasted ; hence, reduced losses.

Thereby, increases the thermal efficiency of the heat exchanger ( higher NTU units ).

5 0
3 years ago
Which of the following is a possible consequence of poor measurement in construction as stated in the segment?
Kamila [148]

Answer:

Decreased risk of structure failure

6 0
2 years ago
An unknown immiscible liquid seeps into the bottom of an open oil tank. Some measurements indicate that the depth of the unknown
barxatty [35]

Answer:

The specific weight of unknown liquid is found to be 15 KN/m³

Explanation:

The total pressure in tank is measured to be 65 KPa in the tank. But, the total pressure will be equal to the sum of pressures due to both oil and unknown liquid.

Total Pressure = Pressure of oil + Pressure of unknown liquid

65 KPa = (Specific Weight of oil)(depth of oil) + (Specific Weight of unknown liquid)(depth of unknown liquid)

65 KN/m² = (8.5 KN/m³)(5 m) + (Specific Weight of Unknown Liquid)(1.5 m)

(Specific Weight of Unknown Liquid)(1.5 m) = 65 KN/m² - 42.5 KN/m²

(Specific Weight of Unknown Liquid) = (22.5 KN/m²)/1.5 m

<u>Specific Weight of Unknown Liquid = 15 KN/m³</u>  

4 0
3 years ago
Ammonia is one of the chemical constituents of industrial waste that must be removed in a treatment plant before the waste can s
Yanka [14]

Answer:

Following is attached the solution or the question given.

I hope it will help you a lot!

Explanation:

5 0
3 years ago
0/5 pts
Brilliant_brown [7]

Explanation:

150 divide by 150 and that how you do the is you what to divide together 15/ 150 you welcome have a good day is you need something else

4 0
3 years ago
Other questions:
  • Please select the word from the list that best fits the definition I love horses and want to be a veterinarian
    12·2 answers
  • A well-insulated tank in a vapor power plant operates at steady state. Saturated liquid water enters at inlet 1 at a rate of 125
    8·1 answer
  • The radial component of acceleration of a particle moving in a circular path is always:________ a. negative. b. directed towards
    9·1 answer
  • What structure was created to help prevent shipwrecks?
    9·1 answer
  • Any help is appreciated.
    7·1 answer
  • In addition to passing an ASE certification test, automotive technicians must have __________ year(s) of on the job training or
    15·1 answer
  • Which option identifies the step skipped in the following scenario?
    9·2 answers
  • Find the remaining trigonometric function of 0 if
    13·1 answer
  • HOLA COMO ESTAN TODOS
    14·1 answer
  • A seamless pipe carries 2400m³ of steam per hour at a pressure of 1.4N/mm².The velocity of flow is 30m/s.assuming the tensile st
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!