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
Workers who work with what kind of chemicals chemicals may require regular medical checkups on a more frequent basis as a result
vazorg [7]
Workers who work with TOXIC chemicals may require regular medical checkups on a more frequent basis as a result of contact.
8 0
2 years ago
As described in "A Note About Bacterial Reproduction -- and the "Culture Bias,"" the organism Epulopisciumdoes not divide by bin
zloy xaker [14]

Answer:

A

Explanation:

The best method that will yield significantly more accurate result is to use spectrophotometer to read the turbidity of the sample and increase in turbidity is associated with increase biomass.

5 0
2 years ago
Air expands through a turbine operating at steady state. At the inlet p1 = 150 lbf/in^2, T1 = 1400R and at the exit p2 = 14.8 lb
Paraphin [41]

Answer:

The power developed in HP is 2702.7hp

Explanation:

Given details.

P1 = 150 lbf/in^2,

T1 = 1400°R

P2 = 14.8 lbf/in^2,

T2 = 700°R

Mass flow rate m1 = m2 = m = 11 lb/s Q = -65000 Btu/h

Using air table to obtain the values for h1 and h2 at T1 and T2

h1 at T1 = 1400°R = 342.9 Btu/h

h2 at T2 = 700°R = 167.6 Btu/h

Using;

Q - W + m(h1) - m(h2) = 0

W = Q - m (h2 -h1)

W = (-65000 Btu/h ) - 11 lb/s (167.6 - 342.9) Btu/h

W = (-65000 Btu/h ) - (-1928.3) Btu/s

W = (-65000 Btu/h ) * {1hr/(60*60)s} - (-1928.3) Btu/s

W = -18.06Btu/s + 1928.3 Btu/s

W = 1910.24Btu/s

Note; Btu/s = 1.4148532hp

W = 2702.7hp

5 0
3 years ago
What engine or car do you think gets better gas mileage a
defon

Answer:

A muscle care

Explanation:

5 0
3 years ago
A fill covering a wide area is to be placed at the surface of this profile. The fill has a total unit weight of 20 kN/m^3 and is
goblinko [34]

Answer:

hello your question lacks some information attached below is the complete question with the required information

answer : 81.63 mm

Explanation:

settlement of the surface due to compression of the clay ( new consolidated )

= 81.63 mm

attached below is a detailed solution to the given problem

8 0
3 years ago
Other questions:
  • Here u go vagdhf dis day did. Du video ioi Hi I gotta go to do something fun to do something that would you want to me see you l
    15·1 answer
  • Name 3 ways in which robots have improved since the Ebola outbreak.
    11·1 answer
  • Define initial set and final set. Briefly discuss one method used to determine them. The following laboratory tests are performe
    12·1 answer
  • What is the capacity of the machine in batches?
    10·1 answer
  • Sublimation is to change from
    7·2 answers
  • In dynamics, the friction force acting on a moving object is always a) in the same direction of its motion b) a kinetic friction
    15·1 answer
  • WHAT IS THE EFFECT OF ICE ACCRETION ON THE LONGITUDINAL STABILITY OF AN AIRCRAFT?
    8·1 answer
  • 2=333=3= im single text in comment
    13·2 answers
  • An open top concrete tank is available to a construction crew to store water. The job site has a daily requirement for 500 gallo
    10·1 answer
  • which of the following statements are true about client-side DNS? (Choose all that apply). a. If an APIPA address is assigned, t
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!