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
A commercial facility has a three-phase, 277 volt, 1200 Amp service. What is the required nominal transformer size needed for th
alekssr [168]

Answer:

The answer is "Option e".

Explanation:

Given value:

\to v_{ph}=277  \ \ \ \ \ \ \  I_{ph} =1200\\\\

vA= v_{Ph} I_{ph}  \  \ \ \to  for \ single \ phase\\\\=3v_{ph} I_{ph}  \ \ \ \ \ \to  for \ 3 - \phi  \\\\s = 3\times 277 \times 1200 \\\\

  =997.200 \ K VA\\\\= 1000 \ k VA

7 0
3 years ago
What 2 disciplines comprise systems engineering?
kirill [66]

Answer:

Engineering and the Engineering management

Explanation:

Systems engineering is a discovery process that includes managing and designing complex systems to formalize the various new research approach or methods.

It is an interdisciplinary holistic approach or field that is comprised of <u>engineering and the engineering management.</u>

The three types of systems engineering are: Product Systems Engineering, Enterprise Systems Engineering and Service Systems Engineering.

5 0
3 years ago
As a general rule of thumb, in-line engines are easier to work on than the other cylinder arrangements.
siniylev [52]

Answer:

The general rule of thumb is that the SMALLER a substance's atoms and the STRONGER the bonds, the harder the substance. Two of the strongest forms of chemical bonds are the ionic and covalent bonds.

Explanation:

5 0
3 years ago
In the truss below, the vertical reaction force at A is
Montano1993 [528]
It’s c trust just trust
7 0
3 years ago
The Leaning Tower of Pisa is located in which country? Question 1 options: France Italy The United States Norway
Ket [755]

Answer:

Tuscany, Central Italy

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Tranquilizing drugs that inhibit sympathetic nervous system activity often effectively reduce people's subjective experience of
    8·1 answer
  • Nearly__________ of all serious occupational injuries and illnesses stem from overexertion of repetitive motion.a. 1/2b. 1/4c. A
    10·1 answer
  • Define the hydraulic diameter for a rectangular duct
    7·1 answer
  • A manometer is used to measure the air pressure in a tank. The fluid used has a specific gravity of 1.25, and the differential h
    13·1 answer
  • How are popsicles made with juice?
    5·2 answers
  • Find the requested quantities for the circuit. We used the mesh-current method to identify the meshes. We then identified the me
    5·1 answer
  • Discuss with your neighbor your brain as a computer.
    14·1 answer
  • A train consists of a 50 Mg engine and three cars, each having a mass of 30 Mg . If it takes 75 s for the train to increase its
    8·1 answer
  • The alternating current frequency used in the United States is
    12·1 answer
  • Describe the potential evidences of child hood fixation that show up in adult personality?​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!