0% found this document useful (0 votes)
491 views

Python Class Programs

The document outlines 11 programming tasks involving creating classes with methods to perform various calculations and data manipulations: 1. Create Circle, Student, and Time classes with methods for area, personal details, and time calculations. 2. Create a Student class and assign roll number and name values. 3. Assign and print student details for two objects. 4. Create a Triangle class to print area and perimeter. 5. Create a Rectangle class to print areas for two rectangles. 6. Create an Area class to print rectangle area from user input. 7. Create an Average class to calculate and print the average of three numbers. 8. Create an Employee class to print

Uploaded by

Priya Shetty
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
491 views

Python Class Programs

The document outlines 11 programming tasks involving creating classes with methods to perform various calculations and data manipulations: 1. Create Circle, Student, and Time classes with methods for area, personal details, and time calculations. 2. Create a Student class and assign roll number and name values. 3. Assign and print student details for two objects. 4. Create a Triangle class to print area and perimeter. 5. Create a Rectangle class to print areas for two rectangles. 6. Create an Area class to print rectangle area from user input. 7. Create an Average class to calculate and print the average of three numbers. 8. Create an Employee class to print

Uploaded by

Priya Shetty
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1. Create a Cricle class and intialize it with radius.

Make two methods getArea and


getCircumference inside this class.

2. Create a Student class and initialize it with name and roll number. Make methods to :
1. Display - It should display all informations of the student.
2. setAge - It should assign age to student
3. setMarks - It should assign marks to the student.

3. Create a Time class and initialize it with hours and minutes.


1. Make a method addTime which should take two time object and add them. E.g.- (2
hour and 50 min)+(1 hr and 20 min) is (4 hr and 10 min)
2. Make a method displayTime which should print the time.
3. Make a method DisplayMinute which should display the total minutes in the Time.
E.g.- (1 hr 2 min) should display 62 minute.

4. Create a class named ‘Student’ with string variable name and integer variable roll|_n’.
Assign the value of roll_no 2 and that of name as John by creating an object of the class
student.

5. Assign and print the roll_no, phone number and address of two students having names
‘Sam’ and ‘john’ respectively bby creating two objects of class students.

6. Write a program to print the area and perimeter of a triangle having sides oof 3,4 n 5
units by creating a class named triangle without any parametr in its constructor and make
another prrogram with parameterized constructor

7. Write a program to print the area of two rectangle having sides (4,5)and (5,8)
respectively by creating a class names rectangle withe a method name ‘Are’ which return
the area and length and breadth passed as parameters to its constructor.

8. Write a program to print the area of a rectangle by creating a class named ‘Area’ ttaking
the values of its length and breadth as parameters of its constructors and having a method
‘return area’ which returns the area of the react angle. Length and breadth of rectangle ae
enered thrroough keyboard

9. Print average of three numbers entered by user by creating class name of ‘Average’
having a method to calculate and print the average.

10. Write a program by creating an ‘Employee’ class having the foll.method and priint the
final salary
a) getInfo - which takes the salary number of hours of work per dat of employee as
parameter.
b) AddSal() - which adds $10 to salary of the employee of it is less than $500
c) Addwork() - which adds Rs.% to salary of employee if the number of hours of work
per day is more than 6 hours.-

11. Create a Temprature class. Make two methods :


1. convertFahrenheit - It will take celsius and will print it into Fahrenheit.
2. convertCelsius - It will take Fahrenheit and will convert it into Celsius.

You might also like