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
lidiya [134]
2 years ago
12

Write a class having two private variables and one-member function which will return the area of the rectangle.

Engineering
1 answer:
Yuri [45]2 years ago
5 0

Using the knowledge in computational language in C++ it is possible to write the code being write a class having two private variables

<h3>Writting the code in C++:</h3>

<em>#include <iostream></em>

<em>using namespace std;</em>

<em />

<em>class Rectangle { /*create a class named Rectangle*/</em>

<em />

<em>   private:</em>

<em>   float l,b; /*this class has two private variables l and b*/</em>

<em>   public:</em>

<em>   float getArea(float l, float b) /*this class has one member-function getArea which returns the area of the rectangle*/</em>

<em>   {</em>

<em>    return l*b; /*return the area of the rectangle*/</em>

<em>   }</em>

<em />

<em>};</em>

<em />

<em />

<em>int main () { /*the main function to check the working of our Rectangle class*/</em>

<em />

<em>  float l,b;</em>

<em>  Rectangle r1; /*create an object r1 of Rectangle class*/</em>

<em>  cout<<"Enter the length of the rectangle: ";</em>

<em>  cin>>l; /*input the length of the rectangle from the user*/</em>

<em>  cout<<"Enter the breadth of the rectangle: ";</em>

<em>  cin>>b; /*input the breadth of the rectangle from the user*/</em>

<em>  cout <<"Area of the rectangle is: "<< r1.getArea(l,b)<<" square units."; /*find the area of the rectangle using the member function of the class*/</em>

<em>  return 0;</em>

<em>}</em>

See more about C++ at brainly.com/question/19705654

#SPJ1

You might be interested in
Document the XSS stored exploit script: Use the View Source feature of the web page and create a screenshot of the few lines cod
Natali [406]

Answer:

Hold on let me ask my brother

Explanation:

5 0
3 years ago
Water at atmospheric pressure boils on the surface of a large horizontal copper tube. The heat flux is 90% of the critical value
masya89 [10]

Answer:

The tube surface temperature immediately after installation is 120.4°C and after prolonged service is 110.8°C

Explanation:

The properties of water at 100°C and 1 atm are:

pL = 957.9 kg/m³

pV = 0.596 kg/m³

ΔHL = 2257 kJ/kg

CpL = 4.217 kJ/kg K

uL = 279x10⁻⁶Ns/m²

KL = 0.68 W/m K

σ = 58.9x10³N/m

When the water boils on the surface its heat flux is:

q=0.149h_{fg} \rho _{v} (\frac{\sigma (\rho _{L}-\rho _{v})}{\rho _{v}^{2} }  )^{1/4} =0.149*2257*0.596*(\frac{58.9x10^{-3}*(957.9-0.596) }{0.596^{2} } )^{1/4} =18703.42W/m^{2}

For copper-water, the properties are:

Cfg = 0.0128

The heat flux is:

qn = 0.9 * 18703.42 = 16833.078 W/m²

q_{n} =uK(\frac{g(\rho_{L}-\rho _{v})     }{\sigma })^{1/2} (\frac{c_{pL}*deltaT }{c_{fg}h_{fg}Pr  } \\16833.078=279x10^{-6} *2257x10^{3} (\frac{9.8*(957.9-0.596)}{0.596} )^{1/2} *(\frac{4.127x10^{3}*delta-T }{0.0128*2257x10^{3}*1.76 } )^{3} \\delta-T=20.4

The tube surface temperature immediately after installation is:

Tinst = 100 + 20.4 = 120.4°C

For rough surfaces, Cfg = 0.0068. Using the same equation:

ΔT = 10.8°C

The tube surface temperature after prolonged service is:

Tprolo = 100 + 10.8 = 110.8°C

8 0
3 years ago
For this question you must write a java class called Rectangle and a client class called RectangleClient. The partial Rectangle
Alex Ar [27]

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

========================================================================================

6 0
3 years ago
For metallurgical reasons, it is desirable to melt the weld metal with minimum energy input. Which one of the following heat sou
stellarik [79]

Answer:

The correct option is;

(a) High power density

Explanation:

The power density of a material is the amount of power per unit volume of the material. Power density, in the context of transformers, fuel cells, batteries, motors, and power supply units, is measured with respect to the volume, and the units is given as W/m³

A system such as a capacitor with an high power density has the capacity to put out large energy amount from a small volume. A capacitor with a high power density, can produce the same power output as a car battery and is said to have a high power density.

8 0
3 years ago
You are testing a new jet engine in a test cell at sea level conditions. You measure the mass flow through the engine and find i
bulgar [2K]

Answer:

43248 newtons.

Explanation:

Force = mass x accelerations and units of force are newtons which are given in the question.

here mass = 125 of air and 2.2 of fuel, total = 125+2.2=127.5kg/s  and the velocity of the exhaust is 340m/s.

force = 340m/s * 127.5kg/s = 43248 newtons technically this is wrong (observe units) but i will expalin how i have taken acceleration as a velocity here and mass/unit time as simply mass.

see force is mass times acceleration or deceleration, here our velocity is not changing therefore it is constant 340m/s but if it were to change and become 0 in one second then there would be -340m/s^2 (note the units ) of deceleration and there would be force associated with it and that force is what i have calculated here. similarly there would be mass in flow rate of mass per second, which is also in that one second of time.

let's calculate error.

error = (actual-calculated)/actual. = (43248-60000)/43248= -38.734% less is ofcourse greater than 2%.

So the load cell is not reading correct to within 2% and it should read 43248newtons.

5 0
3 years ago
Read 2 more answers
Other questions:
  • A circuit contains a 40 ohm resistor and a 60 ohms resistor connected in parallel. If you test this circuit with a DMM you shoul
    14·1 answer
  • A saturated 1.5 ft3 clay sample has a natural water content of 25%, shrinkage limit (SL) of 12% and a specific gravity (GS) of 2
    11·1 answer
  • Which branch of engineering most closely relates to mechanical engineering?
    12·1 answer
  • The complexity of bfs and dfs
    11·1 answer
  • The image shows the relative positions of Earth and the Sun for each of the four seasons. Earth travels in an elliptical orbit a
    11·2 answers
  • Steam enters a heavily insulated throttling valve at 11 MPa, 600°C and exits at 5.5 MPa. Determine the final temperature of the
    14·1 answer
  • Câu 1: Tìm từ trong 2 câu thơ sau liên quan đến các từ: hình chiếu, tia chiếu, mặt phẳng chiếu.
    12·1 answer
  • Can you help me with this
    11·1 answer
  • The toggle (t) flip-flop has one input, clk, and one output, q. on each rising edge of clk, q toggles to the complement of its p
    15·1 answer
  • If a bearing needs 4. 0 s to solidify enough for impact, how high must the tower be?.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!