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
The drag coefficient of a vehicle increases when its windows are rolled down or its sunroof is opened. A sports car has a fronta
klio [65]

Answer:

Explanation:

The additional power consumption of the car when v :

35 mi/h = 0.464hp

70 mi/h = 3.71hp.

For the step by step explanation of how we arrived at these answers, please go through the attached files.

3 0
3 years ago
Read 2 more answers
Using leftover paint colors is acceptable in a paint shop and will help cut down on waste.
Luden [163]
Im pretty sure it is true !
3 0
3 years ago
Read 2 more answers
1. Which of the following will cause a spark knock?
zlopas [31]

Answer:

I couldn't find options for your question online, but I can give you an explanation so you can choose the correct option.

Explanation:

A spark knock is a form of unpredictable behavior that occurs in combustion, that is, in the chemical reaction that occurs between oxygen and an oxidizable material. Such combustion is usually manifested by incandescence or flame.

The spark knock is a detonation that occurs when there is a lot of pressure in the fuel.

<u>Some situations in which this can happen are: </u>

  • Engine overloaded.
  • Maximum pressure in the cylinders.
  • Engine overheated.
  • Overheated air.
  • Long and excessive engine ignition timing.
  • Spark plug at high temperatures.
5 0
3 years ago
The hot and cold inlet temperatures to a concentric tube heat exchanger are Th,i = 200°C, Tc,i = 100°C, respectively. The outlet
alexgriva [62]

Answer:Counter,

0.799,

1.921

Explanation:

Given data

T_{h_i}=200^{\circ}C

T_{h_o}=120^{\circ}C

T_{c_i}=100^{\circ}C

T_{c_o}=125^{\circ}C

Since outlet temperature of cold liquid is greater than hot fluid outlet temperature therefore it is counter flow heat exchanger

Equating Heat exchange

m_hc_{ph}\left [ T_{h_i}-T_{h_o}\right ]=m_cc_{pc}\left [ T_{c_o}-T_{c_i}\right ]

\frac{m_hc_{ph}}{m_cc_{pc}}=\frac{125-100}{200-120}=\frac{25}{80}=C\left ( capacity rate ratio\right )

we can see that heat capacity of hot fluid is minimum

Also from energy balance

Q=UA\Delta T_m=\left ( mc_p\right )_{h}\left ( T_{h_i}-T_{h_o}\right )

NTU=\frac{UA}{\left ( mc_p\right )_{h}}=\frac{\left ( T_{h_i}-T_{h_o}\right )}{T_m}

T_m=\frac{\left ( 200-125\right )-\left ( 120-100\right )}{\ln \frac{75}{20}}

T_m=41.63^{\circ}C

NTU=1.921

And\ effectiveness \epsilon =\frac{1-exp\left ( -NTU\left ( 1-c\right )\right )}{1-c\left ( -NTU\left ( 1-c\right )\right )}

\epsilon =\frac{1-exp\left ( -1.921\left ( 1-0.3125\right )\right )}{1-0.3125exp\left ( -1.921\left ( 1-0.3125\right )\right )}

\epsilon =\frac{1-exp\left ( -1.32068\right )}{1-0.3125exp\left ( -1.32068\right )}

\epsilon =\frac{1-0.2669}{1-0.0834}

\epsilon =0.799

5 0
4 years ago
To solve the problem, make assumptions for missing data and justify. Given:
finlep [7]

Answer:

5,4,1, this is a explication

6 0
3 years ago
Other questions:
  • How do batteries and other types of power sources make physical computing systems more mobile?
    15·2 answers
  • The assignment is to modify the class implementation without changing the functionality. Remove the feet and inches data members
    6·1 answer
  • One cubic meter of nitrogen at 40°C and 340kPa is compressed isoentropically to 0.2m^3. Calculate the final pressure when the ni
    9·1 answer
  • The equation for the velocity V in a pipe with diameter d and length L, under laminar condition is given by the equation V=Δpdsq
    10·1 answer
  • Two loads connected in parallel draw a total of 2.4 kW at 0.8 pf lagging from a 120-V rms, 60-Hz line. One load absorbs 1.5 kW a
    5·1 answer
  • Steam enters an adiabatic turbine at 8 MPa and 500C with a mass flow rate of 3
    11·1 answer
  • PLEASE HELP ME!!!!!! 100 POINTS FOR HELPFUL ANSWERS + BRAINLIEST!!!!!
    14·2 answers
  • It's in the picture please asap
    6·2 answers
  • Oleg is using a multimeter to test the circuit branch you just installed. After turning off the current to the circuit at the se
    5·1 answer
  • What setting do i dry my jordan max arua 2s on in the dryer <br>will mark brainliest
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!