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

Exp No3

Uploaded by

Mochi
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)
22 views1 page

Exp No3

Uploaded by

Mochi
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

Experiment No.

Title: Program on class & objects, Constructor

Programs:
1. Write a program that would print the information (name, year of joining, salary,
address, Designation) of three employees by creating a class named 'Employee'. The
output should be as follows:

Name Year of joining Address Designation Salary

Simran 2000 Nashik Manager 55000

Samar 2001 Solapur Accountant 35000

Karan 1999 Kolhapur Sr.Clerk 30000

2. Define a class salary which will contain data members basic TA, DA, HRA. Write a
program using constructor which will initialize theses values for object. Calculate total
salary of two employee using method.
3. Create a class Number which contain function named "digitName" that takes an
integer argument in the range from 1 to 9, inclusive, and prints the English name for
that integer on the computer screen. If the argument is not in the required range,
then the function should print "digit error".
4. Define a class Book having instance variables: name, total page, price and author
name. Initialize these values using constructor for four objects and calculate average
pages and average price.
5. Create a class named 'Rectangle' with two data members 'length' and 'breadth' and
two methods to print the area and perimeter of the rectangle respectively. Its
constructor having parameters for length and breadth is used to initialize length and
breadth of the rectangle. Print the area and perimeter of a rectangle for 6 objects.
6. Write a program to create a class Area and calculate area of circle, rectangle and cube
using constructor overloading.

You might also like