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]
1 year 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]1 year 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
The difference in quantity between the add and full marks on an engine oil dipstick is typically
svetoff [14.1K]

Answer:

1 quart (0.9 liters).

Explanation:

A proper inspection of various systems and components in a vehicle at regular intervals is very important and necessary because it helps to ensure that the vehicle is in a safe and reliable condition.

Generally, these inspection includes tyres, lighting systems, fan belts, shock absorbers, fluid (oil and water) level, etc. If any fault or concern is detected in the course of an inspection, it should be noted for quick repair or servicing by an expert technician.

All automobile engine requires an adequate amount of engine oil as a lubricant so as to mitigate friction and enhance proper functionality of the vehicle. Thus, the proper functionality of an engine is largely dependent on the level of the engine oil; it shouldn't be too low or high.

Basically, the engine oil should be checked at regular intervals (periodically) and should be on the level indicated or chosen by the manufacturer of the vehicle.

A dipstick is designed to be used for checking the engine oil level in a vehicle and it is marked with lines indicating minimum and maximum, low and high or add and full.

The difference in quantity between the add and full marks on an engine oil dipstick is typically 1 quart (0.9 liters).

5 0
2 years ago
Volume of sale (i.e., the number of parts sold) is a factorwhen determining which
nadya68 [22]

Answer: N has to be lesser than or equal to 1666.

Explanation:

Cost of parts N in FPGA = $15N

Cost of parts N in gate array = $3N + $20000

Cost of parts N in standard cell = $1N + $100000

So,

15N < 3N + 20000 lets say this is equation 1

(cost of FPGA lesser than that of gate array)

 Also. 15N < 1N + 100000  lets say this is equation 2  

(cost of FPGA lesser than that of standardcell)

Now

From equation 1

12N < 20000

N < 1666.67

From equation 2

14N < 100000

N < 7142.85

AT the same time, Both conditions must hold true

So N <= 1666 (Since N has to be an integer)

N has to be lesser than or equal to 1666.

3 0
3 years ago
Select the correct answer.
Ulleksa [173]
The answer is A. Immediately inform her colleague
4 0
2 years ago
1. Describe simply what will happen to an airplane in flight in the following conditions:
notka56 [123]

Answer:

For the two you haven't answered: (Drag greater than thrust, lift greater than weight) It will accelerate backwards (decelerate) and upwards

(Lift greater than weight, thrust greater than drag) accelerate upwards and forwards.

4 0
3 years ago
You are designing the access control policies for a Web-based retail store. Customers access the store via the Web, browse produ
PolarNik [594]

Answer:

Object-Oriented Software Engineering Using UML, Patterns, and Java, 3e, shows readers how to use both the principles of software engineering and the practices of various object-oriented tools, processes, and products.

3 0
2 years ago
Other questions:
  • The temperature of a flowing gas is to be measured with a thermocouple junction and wire stretched between two legs of a sting,
    8·1 answer
  • function summedValue = SummationWithLoop(userNum) % Summation of all values from 1 to userNum summedValue = 0; i = 1; % Write a
    11·1 answer
  • A Scalar can only be a positive quantity that has a magnitude but no direction ? a)-True b)-False
    5·1 answer
  • An insulated piston–cylinder device initially contains 1 m3 of air at 120 kPa and 17°C. Air is now heated for 15 min by a 200-W
    7·1 answer
  • A steam power plant operating on a simple ideal Rankine cycle maintains the boiler at 6000 kPa, the turbine inlet at 600 °C, and
    11·1 answer
  • The ultimate BOD of a river just below a sewage outfall is 50.0 mg/L, and the oxygen deficit at the outfall D0 is 2.0 mg/L. The
    6·1 answer
  • Resistance depends on which three properties of a wire?
    15·1 answer
  • 10 properties of metals?<br> ​
    10·2 answers
  • A) If a given directional antenna can receive 15 times the power of an isotropic antenna, what is
    11·1 answer
  • What’s the answer to this I don’t understand
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!