Question: Can you please do it in C++? 1. Create a class named 'Student' with a string variable 'name' and an integer variable 'roll_no'. Assign the

 Can you please do it in C++? 1. Create a class

Can you please do it in C++?

1. Create a class named 'Student' with a string variable 'name' and an integer variable 'roll_no'. Assign the value of roll_no as ' 2 ' and that of name as "John" by creating an object of the class Student. 2. Assign and print the roll number, phone number and address of two students having names "Sam" and "John" respectively by creating two objects of the class 'Student'. 3. Write a program to print the area and perimeter of a triangle having sides of 3,4 and 5 units by creating a class named 'Triangle' with a function to print the area and perimeter. 4. Write a program to print the area and perimeter of a triangle having sides of 3,4 and 5 units by creating a class named 'Triangle' with the constructor having the three sides as its parameters. 5. Write a program to print the area of two rectangles having sides (4,5) and (5,8) respectively by creating a class named 'Rectangle' with a function named 'Area' which returns the area. Length and breadth are passed as parameters to its constructor

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!