Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 constructorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started