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
DRIVERS ED
forsale [732]

Answer:

b

Explanation:

only if there signal is turned on

8 0
2 years ago
Read 2 more answers
A water supply agency is planning to add two reservoirs to its system. Water will flow from Reservoir A to Reservoir B via a 10,
NikAS [45]

Attached is the solution to the above question.

3 0
3 years ago
A boiler is used to heat steam at a brewery to be used in various applications such as heating water to brew the beer and saniti
Natalija [7]

Answer:

net boiler heat = 301.94 kW

Explanation:

given data

saturated steam = 6.0 bars

temperature = 18°C

flow rate = 115 m³/h = 0.03194 m³/s

heat use by boiler = 90 %

to find out

rate of heat does the boiler output

solution

we can say saturated steam is produce at 6 bar from liquid water 18°C

we know at 6 bar from steam table

hg = 2756 kJ/kg

and

enthalpy of water at 18°C

hf = 75.64 kJ/kg

so heat required for 1 kg is

=hg - hf

= 2680.36 kJ/kg

and

from steam table specific volume of saturated steam at 6 bar is 0.315 m³/kg

so here mass flow rate is

mass flow rate = \frac{0.03194}{0.315}

mass flow rate m = 0.10139 kg/s

so heat required is

H = h × m  

here h is heat required and m is mass flow rate

H = 2680.36  × 0.10139

H =  271.75 kJ/s = 271.75 kW

now 90 % of boiler heat is used for generate saturated stream

so net boiler heat = \frac{H}{0.90}

net boiler heat = \frac{271.75}{0.90}

net boiler heat = 301.94 kW

5 0
2 years ago
Which of these is not a type of socket
kotegsom [21]
You didn’t put a picture
7 0
2 years ago
Cho P1= XdaN, P2=3.X daN, P= 2.X (daN). a=1m, b=2m,MCN hình tròn d= (100+X)mm1/ Tính nội lực tại các mặt cắt cách ngàm 0,5m; 1m;
DaniilM [7]

Answer:

Please explain it in English so that i can help or you need someone else who can speak Vietnam

5 0
2 years ago
Other questions:
  • Write a program to control the operation of the RED/GREEN/BLUE LED (LED2) as follows: 1. If no button is pressed, the LED should
    15·1 answer
  • How can endurance athletes best delay muscle fatigue during training? a. By avoiding sports drinks during exercise b. By eating
    6·2 answers
  • Which of the following is an example of an iterative process?
    12·1 answer
  • A stainless-steel specimen from the same material characterized up above, was formed into a rectangular cross-section of dimensi
    9·1 answer
  • Different types of steels contain different elements that alter the characteristics of the steel. For each of the following elem
    6·1 answer
  • Suppose a student rubs a Teflon rod with wool and then briefly touches it to an initially neutral aluminum rod suspended by insu
    6·1 answer
  • The following median grain size data were obtained during isothermal liquid phase sintering of an 82W-8Mo-8Ni-2Fe alloy. What is
    15·1 answer
  • For an Otto cycle, plot the cycle efficiency as a function of compression ratio from 4 to 16.
    14·1 answer
  • A manufacturer has been asked to produce 100 customized metal discs with a particular pattern engraved on them. Which production
    10·2 answers
  • Difference between theory and practice?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!