50.Programming Assignment 11- using OOPs

1.create class Arith to do arithmetic operation.It contains a member function read() to read the two numbers and add() method to find the sum. You can add more methods to the class to incorporate more functionality.class Arith:

2.create a class Rectangle .A constructor is used to initialize the object values. Member function area() to compute the area of the rectangle ( university question)

3.Create a class car with attributes model, year and price and a method cost() for displaying the prize. Create two instance of the class and call the method for each instance.(university question)

4.Create a class student with attribute name and roll number and a method dataprint() for displaying the same. Create two instance of the class and call the method for each instance.( university question)

5.Create a class Person with attributes name, age salary and a method display() for showing the details. Create two instances of the class and call the method for each instance.

6.Define a class Mobile to store the details of a Mobile (company, model,price) with the following methods.
a) set_details()- to set the values to the data attributes
b)display_details()-to display the data attribute values
Create an object of the class and invoke methods. ( university question)

7.Define a class in Python to store the details of students( rollno, mark1,mark2) with the following methods
readData()- to assign values to class attributes
computeTotal()-to find the total marks
printDetails()- to print the attribute values and total marks.
Create an object of this class and invoke the methods. ( University question)

8.Define a class in Python to store the details of book( title,author,cost) with the following methods
get_details()- to assign values to class attributes
print_details()- to display the attribute values
Create an object of this class and invoke the methods. ( University question)


9. Write a Python program to express the instances as return values to define a class RECTANGLE with parameters height, width, corner_x, and corner_y and member functions to find center, area, and perimeter of an instance.(university question)


10.Write Python program to create a class called as Complex and implement __add__( ) method to add two complex numbers. Display the result by overloading the + Operator. ( refer example)

11.Create a Point class to handle a point (x,y). Use a constructor to initialize the Point( default (0,0)).
Use __str__ function to display the point object using print function.Overload + ,- and < operator using appropriate function.

12.Create a Stud class with rno,name and mark as data items and member function to read and display the data.Create another class Percentage with data to store percentage and a member function to display the percentage.Create a Percentage class object. Read the students details and also print the students data including the percentage using the Percentage class object.

13.Write a Python class named Circle constructed by a radius and two methods which will compute the area and the perimeter of a given circle ( university question)

Comments

Popular posts from this blog

Python For Machine Learning - CST 283 - KTU Minor Notes- Dr Binu V P

46.Classes and Objects in Python- Accessors and mutators

KTU Python for machine learning Sample Question Paper and Answer Key Dec 2020