Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program to find out the area of an rectangle be defining a class named as Rectangle having length and breadth as its data members. Declare another class named as Rectangle Area having one member function named as area to calculate the area by taking the data length and breadth from the Rectangle class. Solve this by using friend class.


Write a program to exchange values(swap) between two classes by using friend function(call by reference).


Write a program by using friend function to add data objects of two different classes ABC and XYZ.


Write a C++ program that declares three arrays of char elements. The first two arrays are
initialized with string literal constants, "Please, enter your first name: " and "Hello, ", while the
third one is left uninitialized for the first name entered.

Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale which inherits both the above classes. Now, create a function in each of these classes which prints "I am mammal", "I am a marine animal" and "I belong to both the categories: Mammals as well as Marine Animals" respectively. Now, create an object for each of the above class and try calling

1.  function of Mammals by the object of Mammal

2. function of MarineAnimal by the object of MarineAnimal

3. function of BlueWhale by the object of BlueWhale

4. function of each of its parent by the object of BlueWhale

 


We want to calculate the total marks of each student of a class in Physics,Chemistry and Mathematics and the average marks of the class. The number of students in the class are entered by the user. Create a class named Marks with data members for roll number, name and marks. Create three other classes inheriting the Marks class, namely Physics, Chemistry and Mathematics, which are used to define marks in individual subject of each student. Roll number of each student will be generated automatically.




Make a class named Fruit with a data member to calculate the number of fruits in a basket. Create two other class named Apples and Mangoes to calculate the number of apples and mangoes in the basket. Print the number of fruits of each type and the total number of fruits in the basket.

 


Write a probram with a mother class animal. Inside it define a name and an age variables, and set_value() function.Then create two bases variables Zebra and Dolphin which write a message telling the age, the name etc.



Write a program that defines a shape class with a constructor that gives value to width and height. The define two sub-classes triangle and rectangle, that calculate the area of the shape area ().

 

In the main, define two variables a triangle and a rectangle and then call the area() function in this two varibles.


Write a Math Class will perform the basic functions (+, -, *, /). Write two classes the SimpleCalculator and ScientificCalculator that will inherit the Math class.

 

Write specific methods, attributes to the classes and show the results.



LATEST TUTORIALS
APPROVED BY CLIENTS