1. Write a C++ program using class with data member’s int feet,float inches to represent distance and define function that takes two distance values as arguments and returns the larger one.Include a main program that accepts two distance figures from the user compare them and displays the larger using Inline function.
2. Consider the mystring class
char str ;
Overloading the method called “check” for the class to perform the following operations.
i)Check if a specific character is present in str. Returns position if found, -1 if not.
ii)Compares the length of two mystring objects and returns 1 if they are equal, 0 if not. With attribute real and imaginary.
3. Define a class for a 3 dimensional points.
Write necessary member functions for accepting & displaying the point object.
Overload the following operators:
Operator Example Purpose
+ (Binary) p3=p1+p2 adds coordinates of point p1 to p2.
– (Unary) -p1 Negates coordinates of point p1.
7. Define a class for 3 dimensional points necessary member
functions for accepting and the point object Overload the following operators:
Operator Example Purpose
* (Binary) p3=p1*p2 multiplies coordinates of point p1 with p2.
– (Binary) p3=p2-p1 subtracts coordinates of p1 from p2.
14. Consider the following class Person
char Name ;
char Addr ;
int Property;//in sq. foot area
Calculate tax amount by checking salary and the property of the person
For salary <5000 tax rate=0
For salary >=5000||<=10000 tax rate= 14% of salary.
For salary >=10000 tax rate =16% of salary.
In this tax amount add following amt depending on the size of area in sq.foot
For 1000 sq. foot area amt=0.
For >1000|| < 5000 sq. foot area amt= 1000
For >5000||<= 10000 sq. foot area amt=3000.
15. Write a C++ program to define function power to raise a number m to a power n the function takes a double value for m. And integervalue for n and return the result correctly use a default value of 2 for n to make the function calculate squares when this argument is omitted
19. Design a class which contain static data member and member function show() which displays number of times display operation is performed irrespective of the object responsible for display using static data member.
22. Create a C++ class for a student object with the following attributes— roll no, name, number of subjects , marks of subjects. The number of subjects varies for each student. Write a parameterized constructor which initializes roll number, name and number of subject and creates the array for marks dynamically, write member function for accepting marks and display all information of student.