0% found this document useful (0 votes)
4 views1 page

Assignment No2

The document outlines an assignment for OOPS C++ for B.Tech 3rd semester students, consisting of six programming tasks. These tasks involve creating classes for rectangles and students, implementing function overloading, using structures for distance and marks, and calculating areas and percentages. Each task emphasizes object-oriented programming principles and requires students to demonstrate their understanding through coding exercises.

Uploaded by

sumoshravan35
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Assignment No2

The document outlines an assignment for OOPS C++ for B.Tech 3rd semester students, consisting of six programming tasks. These tasks involve creating classes for rectangles and students, implementing function overloading, using structures for distance and marks, and calculating areas and percentages. Each task emphasizes object-oriented programming principles and requires students to demonstrate their understanding through coding exercises.

Uploaded by

sumoshravan35
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

ASSIGNMENT NO-2

OOPS C++ (B.Tech 3rd Sem)


Section-G and Section-H(CSE)

Q.1 Create a class named 'Rectangle' with two data members- length and breadth and a
function to calculate the area which is 'length*breadth'. The class has three
constructors which are:
1-having no parameter - values of both length and breadth are assigned zero.
2 - having two numbers as parameters - the two numbers are assigned as length and breadth
respectively.
3 -having one number as parameter - both length and breadth are assigned that number.
Now, create objects of the 'Rectangle' class having none, one and two parameters and print
their areas.
Q.2 Write a program to print the names of students by creating a Student class. If no
name is passed while creating an object of the Student class, then the name should be
"Unknown", otherwise the name should be equal to the String value passed while
creating the object of the Student class.
Q.3 Create a class to print the area of a square and a rectangle. The class has two
functions with the same name but different number of parameters. The function for
printing the area of rectangle has two parameters which are its length and breadth
respectively while the other function for printing the area of square has one parameter
which is the side of the square.
Q.4 Write a program to add two distances in inch-feet using structure. The values of the
distances are to be taken from the user.
Q.5 Create a class to print an integer and a character using two functions having the
same name but different sequence of the integer and the character parameters.
For example, if the parameters of the first function are of the form (int n, char c), then
that of the second function will be of the form (char c, int n).
Q.6 Enter the marks of 5 students in Chemistry, Mathematics and Physics (each out of
100) using a structure named Marks having elements roll no., name, chem_marks,
maths_marks and phy_marks and then display the percentage of each student.

You might also like