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
A Pelton wheel is supplied with water from a lake at an elevation H above the turbine. The penstock that supplies the water to t
gayaneshka [121]

Answer:

Following are the proving to this question:

Explanation:

\frac{D_1}{D} = \frac{1}{(2f(\frac{l}{D}))^{\frac{1}{4}}}

using the energy equation for entry and exit value :

\to \frac{p_o}{y} +\frac{V^{2}_{o}}{2g}+Z_0  = \frac{p_1}{y} +\frac{V^{2}_{1}}{2g}+Z_1+ f \frac{l}{D}\frac{V^{2}}{2g}

where

\to p_0=p_1=0\\\\\to Z_0=Z_1=H\\\\\to v_0=0\\\\AV =A_1V_1 \\\\\to V=(\frac{D_1}{D})^2 V_1\\\\\to V^2=(\frac{D_1}{D})^4 V^{2}_{1}

         = (\frac{1}{(2f (\frac{l}{D} ))^{\frac{1}{4}}})^4\  V^{2}_{1}\\\\

         = \frac{1}{(2f (\frac{l}{D})  )} \  V^{2}_{1}\\

\to \frac{p_o}{y} +\frac{V^{2}_{o}}{2g}+Z_0  =\frac{p_1}{y} +\frac{V^{2}_{1}}{2g}+Z_1+ f \frac{l}{D}\frac{V^{2}}{2g} \\\\

\to 0+0+Z_0 = 0  +\frac{V^{2}_{1} }{2g} +Z_1+ f \frac{l}{D} \frac{\frac{1}{(2f(\frac{l}{D}))}\ V^{2}_{1}}{2g}   \\\\\to Z_0 -Z_1 = +\frac{V^{2}_{1}}{2g} \ (1+f\frac{l}{D}\frac{1}{(2f(\frac{l}{D}) )} )  \\\\\to H= \frac{V^{2}_{1}}{2g} (\frac{3}{2}) \\\\\to  \frac{V^{2}_{1}}{2g} = H(\frac{3}{2})

L.H.S = R.H.S

7 0
2 years ago
Before finishing and installing a shelved cabinet you just constructed, you need to check the
Greeley [361]

Answer:

Carpenter's square

Explanation:

The most common hand tool used to measure or set angles with its application extending to setting angles of roofs and rafters. Another name of a Carpenter's square is a framing square.

Other hand tools that are used to measure angles are;

  • The combination square that allows a user to set both 90°  and 45° angles
  • A Bevel that allows users to set any angle they like.
  • A Protractor that resembles a bevel but its marks are marked in an arc.
  • An electromagnetic angle finder which gives a reading according to the measure of the arms adjusted by the user.
7 0
2 years ago
The cube measures 3.0-ft on all sides and has a density of 3.1 slugs/ft3. How much does it weigh?
kodGreya [7K]

Answer:

W = 2695.14 lb

Explanation:

given,

side of cube = 3 ft

density of the cube = 3.1 slugs/ft³

we know,

density = \dfrac{mass}{volume}

mass = density x volume

volume = 3³ = 27 ft³

mass =  3.1  x 27

    m = 83.7 slugs.

weight calculation

converting mass from slug to pound

weight of 1 slug is equal to 32.2 lb

now,

weight of the cube is equal to

  W = 83.7 slugs x 32.2 lb/slug

  W = 2695.14 lb

hence, weight is equal to W = 2695.14 lb

4 0
3 years ago
A microwave transmitter has an output of 0.1W at 2 GHz. Assume that this transmitter is used in a microwave communication system
Len [333]

Answer:

gain = 353.3616

P_r = 1.742*10^-8 W

Explanation:

Given:

- The output Power P_o = 0.1 W

- The diameter of the antennas d = 1.2 m

- The frequency of signal f = 2 GHz

Find:

a. What is the gain of each antenna?

b. If the receiving antenna is located 24 km from the transmitting antenna over a free space path, find the available signal power out of the receiving antenna.

Solution:

- The gain of the parabolic antenna is given by the following formula:

                            gain = 0.56 * 4 * pi^2 * r^2 / λ^2

Where, λ : The wavelength of signal

            r: Radius of antenna = d / 2 = 1.2 / 2 = 0.6 m

- The wavelength can be determined by:

                            λ = c / f

                            λ = (3*10^8) / (2*10^9)

                            λ = 0.15 m

- Plug in the values in the gain formula:

                            gain = 0.56 * 4 * pi^2 * 0.6^2 / 0.15^2

                            gain = 353.3616

- The available signal power out from the receiving antenna is:

                            P_r = (gain^2 * λ^2 * W) / (16*pi^2 * 10^2 * 10^6)

                            P_r = (353.36^2 * 0.15^2 * 0.1) / (16*pi^2 * 10^2 * 10^6)

                            P_r = 1.742*10^-8 W

4 0
3 years ago
The solid aluminum shaft has a diameter of 50 mm. Determine the absolute maximum shear stress in the shaft and sketch the shear-
jarptica [38.1K]

Answer:

Max shear = 8.15 x 10^7 N/m2

Explanation:

In order to find the maximum stress for a solid shaft having radius r, we will be applying the Torsion formula which can be written as;

Allowable Shear Stress = Torque x Radius / pi/2 x radius^4

Putting the values we have;

T = 2000 N/m

Radius = Diameter/2 = 0.05 / 2 = 0.025 m

Putting values in formula;

Max shear = 2000 x 0.025 / 3.14/2 x (0.025)^4

Max shear = 8.15 x 10^7 N/m2

5 0
2 years ago
Other questions:
  • A bar of steel has the minimum properties Se = 40 kpsi, Sy = 60 kpsi, and Sut = 80 kpsi. The bar is subjected to a steady torsio
    7·1 answer
  • How does a car batteray NOT die?
    13·1 answer
  • Determine displacement (in) of a 1.37 in diameter steel bar, which is 50 ft long under a force of 27,865 lb if elasticity modulu
    5·1 answer
  • Please help me with this question​
    8·1 answer
  • A photovoltaic panel of dimension 2m×4m is installed on the
    14·1 answer
  • . A 10W light bulb connected to a series of batteries may produce a brighter lightthan a 250W light bulb connected to the same b
    8·2 answers
  • Determine the average and rms values for the function, y(t)=25+10sino it over the time periods (a) 0 to 0.1 sec and (b) 0 to 1/3
    9·1 answer
  • How long should the shafts remain in the furnace to achieve a desired centerline temperature of 800K? 2) Determine the temperatu
    5·1 answer
  • The specific gravity of a fluid with a weight density of 31.2 lb/ft is a. 2.00 b. 0.969 c. 0.500 d. 1.03
    10·1 answer
  • What is the measurment unit of permeability?​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!