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
5. Assume that you and your best friend ench have $1000 to invest. You invest your money
Bezzdna [24]

Correct question reads;

Assume that you and your best friend each have $1000 to invest. You invest your money in a fund that pays 10% per year compound interest. Your friend invests her money at a bank that pays 10% per year simple interest. At the end of 1 year, the difference in the total amount for each of you is:

(a) You have $10 more than she does

(b) You have $100 more than she does

(c) You both have the same amount of money

(d) She has $10 more than you do

<u>Answer:</u>

<u>(d) She has $10 more than you do</u>

<u>Explanation</u>:

Using the compound interest formula

A= P [ (1-i)^n-1

Where P = Principal/invested amount, i = annual interest rate in percentage, and n = number of compounding periods.

<u>My compound interest is:</u>

= 1000 [ (1-0.1)^1-1

= $1000

$1,000 + $1,000 invested= $2,000 total amount received.

<u>My friend's simple interest is;</u>

To determine the total amount accrued we use the formula:

P(1 + rt) Where:

P = Invested Amount (1000)

I = Interest Amount (10,000)

r = Rate of Interest per year (10% or 0.2)

t = Time Period (1 )

= 1000 (1 + rt)

= 1000 (1 + 0.1x1)

= $1100 + $1000 invested = $2100 total amount received.

Therefore, we observe that she (my friend) has $100 more than I do.

5 0
3 years ago
If a shear stress acts in one plane of an element, there must be an equal and opposite shear stress acting on a plane that is
xxMikexx [17]

Answer:

90 degrees

Explanation:

In the case when the sheer stress acts in the one plane of an element so it should be equal and opposite also the shear stress acted on a plan i.e. 90 degrees from the plane

Therefore as per the given situation it should be 90 degrees from the plane

hence, the same is to be considered and relevant too

5 0
3 years ago
Read 2 more answers
Find the resistance of a circuit that draws 4 amperes with 8 volts applied?
vodka [1.7K]

Answer:

2 ohms

Explanation:

V = I * R

8 = 4 * R

8 / 4 = R

R = 2 ohms

5 0
3 years ago
A company has a stack that emits a hazardous air pollutant. The ground mass concentration directly downwind of the plume sometim
fredd [130]

Answer:

do the wam wam

Explanation:

3 0
3 years ago
Read 2 more answers
Carbon nanotubes can be a considered toxic agent due to: (a)- Its ability to produce toxic gases (b)Its ability to penetrate ski
SpyIntel [72]

Answer: b)Its ability to penetrate skin quickly due to its very small diameter

Explanation: Carbon nano tubes(CNT) are the material widely used in the medical field due to the atomic structure of it ans also have small size. Toxicity in the carbon nano tubes is because their small sized atomic particles which can enter the skin by penetration or inhalation. But are still preferred in the medicine because having unique properties like mechanical property, chemical property,surface property etc.

4 0
3 years ago
Other questions:
  • A coal-burning power plant generates electrical power at a rate of 650 megawatts (MW), or 6.50 × 108 J/s. The plant has an overa
    12·1 answer
  • A student proposes a complex design for a steam power plant with a high efficiency. The power plant has several turbines, pumps,
    6·1 answer
  • By efficiency, we generally mean the ratio of the desired output to the required input. That is, efficiency is a measure of what
    7·1 answer
  • (d) Suppose two students are memorizing a list according to the same model dL dt = 0.5(1 − L) where L represents the fraction of
    6·1 answer
  • Design complementary static CMOS circuits with minimized number of transistors to realize the following Boolean functions (hint:
    13·1 answer
  • A cylindrical specimen of a metal alloy 45.8 mm long and 9.72 mm in diameter is stressed in tension. A true stress of 378 MPa ca
    11·1 answer
  • Which of these are factors of 121?
    13·2 answers
  • 11. Technicians A and B are discussing
    12·1 answer
  • For two different air velocities, the Nusselt number for two different diameter cylinders in cross flow is the same. The average
    6·1 answer
  • Select the correct answer.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!