PHASE
I
Q1.WAP to design a class RECTANGLE,
which has data members like len,width,ar,peri. It It should have some member
functions like getdata(), dispdata(),cal_area() & calc_peri().
Q2.WAP to design a class Triangle, which
has data members like side_a,side_b,side_c,ar,peri. It It should have some
member functions like getdata(), dispdata(),cal_area() & calc_peri().
Q3. WAP to demonstrate the classes Square,
Triangle & Circle in a same program .[ HINT: USE of Scope Resolution
Operator].
Q4. WAP to demonstrate a class STUDENT
which has data members like rno, age, marks, name. It should have some member
functions like getdata(), dispdata(),cal_total(), etc.
Q5. WAP to demonstrate a class INTEGER which
has data members like num1, num2, result. It should have some member functions
like getdata(), dispdata(),add(), sub(),mult(),div().
Q6. WAP to demonstrate a class INTEGER_CALC
which has data members like num. It should have some member functions like
getdata(), dispdata(),is_even(), is_prime(), is_palindrome( ),power(),fact(),
reverse(),sum_of_disits()etc.
Q7. WAP to demonstrate a class COMPLEX,
which has two data members of int type. It should have some member functions
like getdata(), dispdata(),add(), sub(), prod() etc.
Q8. Create a class called user_time that
has separate integer members for hours, minutes and seconds. One member
function should initialize this data to 0, and another should initialize it to
fixed values. A member function should display it in HH:MM:SS format. The final
two member functions should add and subtract two objects of time passed as
arguments. A main () program should create two initialized user_time objects.
Then it should add the two initialized together, leaving the result in the
third user_time object. Finally it should display the value of third
variable.
Q9.
Create
a class called Distance that has
separate member data inches and feet. One member function should initialize
this data to 0, and another should initialize it to the values entered by user.
A member function should display it. The member function should add two objects
of type distance passed as arguments.[ 1
feet =12 inches]
Q10. Explain the concept of this
pointer with the help of examples.
Q11. WAP to demonstrate the use of an array inside
a class( eg Marks of student).
Q12. WAP to demonstrate the use of an array of
objects in the main() function.
NOTE:Write Question in Black ink... Solution in blue ink & Output shuld be Printed.
NOTE:Write Question in Black ink... Solution in blue ink & Output shuld be Printed.
No comments:
Post a Comment