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
What is Geography? pliz help​
UkoKoshka [18]

Answer:

hope it's helpful please like and Follow me

8 0
3 years ago
Read 2 more answers
What should i do to my nissan 350z, twin charge it or have twin turbos, to twin turbos with a super charger? i want it to be ove
bulgar [2K]

Answer:

A

Explanation:

It just makes sense

4 0
3 years ago
What are the 5 major forest types?
Nataly [62]

Answer:

1. Equatorial Evergreen or Rainforest

2. Tropical forest

3. Mediterranean forest

4. Temperate broad-leaved forest

5. Warm temperate forest

Explanation:

4 0
4 years ago
Read 2 more answers
When storing used oil, it needs to be kept in ___________ containers. A) MetalB) PlasticC) UncoveredD) Leakproof
Romashka-Z-Leto [24]

Answer:

D. Leak-proof

Explanation:

Used oils are required to be stored in closed containers or tanks which will remain closed when oil is not added or removed. Alternatively, used oils can be stored in containers labeled "Used Oil"  for regulated hazardous waste storing. A leak-proof container is one that has no drips and dribbles when the container lid is closed. These containers should be kept in good conditions away from rusting, leaks or deteriorations. It is important to mention that used oil should not be stored in anything apart from tanks and leak-proof storage containers.

8 0
3 years ago
If the maximum allowable shear stress is 70 MPa, find the shaft diameter needed to transmit 40 kW when the shaft speed is 250 rp
victus00 [196]

Answer:

The diameter is 50mm

Explanation:

The answer is in two stages. At first the torque (or twisting moment) acting on the shaft and needed to transmit the power needs to be calculated. Then the diameter of the shaft can be obtained using another equation that involves the torque obtained above.

T=(P×60)/(2×pi×N)

T is the Torque

P is the the power to be transmitted by the shaft; 40kW or 40×10³W

pi=3.142

N is the speed of the shaft; 250rpm

T=(40×10³×60)/(2×3.142×250)

T=1527.689Nm

Diameter of a shaft can be obtained from the formula

T=(pi × SS ×d³)/16

Where

SS is the allowable shear stress; 70MPa or 70×10⁶Pa

d is the diameter of the shaft

Making d the subject of the formula

d= cubroot[(T×16)/(pi×SS)]

d=cubroot[(1527.689×16)/(3.142×70×10⁶)]

d=0.04808m or 48.1mm approx 50mm

7 0
4 years ago
Other questions:
  • Diesel engines do not use spark plugs to ignite the fuel-air mixture. Instead, they rely on the compression stroke to raise the
    12·1 answer
  • Anne-Marie Cole runs the sales division for a local auto insurance firm. One of her key duties is to calculate her company's mar
    11·2 answers
  • Which of the following is a direct result of technological improvements in the music industry?
    9·2 answers
  • Which word is used to describe Sweden,Normay,and Denmark
    6·1 answer
  • Obese children develop high blood pressure, heart disease, and Type II diabetes at a younger age than children of a healthy weig
    9·2 answers
  • A tailgate may have a latch on both sides.<br> O True<br> O False
    10·2 answers
  • How to draw the output voltage waveform rectifier
    8·1 answer
  • Dimension these please.
    9·1 answer
  • The uniform beam has a mass of 50 kg determine the reaction at the support​
    13·1 answer
  • Technician A says that the definition of torque is how far the crankshaft twists in degrees.Technician B says that torque can re
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!