KEMBAR78
Assignment 3 UI | PDF | Object Oriented Programming | Information Technology
0% found this document useful (0 votes)
17 views3 pages

Assignment 3 UI

This document outlines Assignment 3 for the CIS-122T course, focusing on Object Oriented Programming. It requires the implementation of classes for Students and Teachers, including methods for data input, searching, and displaying information. The assignment is due on 23-06-2025 and is worth a total of 4 marks.

Uploaded by

siddiqhaji0001
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)
17 views3 pages

Assignment 3 UI

This document outlines Assignment 3 for the CIS-122T course, focusing on Object Oriented Programming. It requires the implementation of classes for Students and Teachers, including methods for data input, searching, and displaying information. The assignment is due on 23-06-2025 and is worth a total of 4 marks.

Uploaded by

siddiqhaji0001
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/ 3

Assignment 3

CIS-122T: Object Oriented Programming

Name: Hamza Rizvi

Roll No: 2024F-BCIS-059

Program: Cloud Computing and Information Sciences

Announced Date: 16-06-2025 Due Date: 23-06-2025 Total Marks: 04

Sr. No Course Learning PLOs Bloom's Taxonomy


Outcomes

1 Apply OOP PLO_3 (Problem C3 (Solve)


techniques and Analysis)
algorithms to solve
real-world problems

Question #1:
Implement these classes and incorporate the functions described in the class diagram. [4
Marks]

- Create an Application class with 5 Student objects and 3 Teacher objects.

- getdata(): Should ask the user to input the data for the teacher and parent class attributes,
same for the student class.

- searchstd(), searchteacher(): should return a Boolean if the match is found.

- displayinfo(): should display all the information of the attributes and parent class.

Python Code Implementation:

class Person:
def __init__(self):
self.name = ""
self.age = 0

def getdata(self):
self.name = input("Enter name: ")
self.age = int(input("Enter age: "))

def displayinfo(self):
print(f"Name: {self.name}, Age: {self.age}")
class Teacher(Person):
def __init__(self):
super().__init__()
self.subject = ""

def getdata(self):
super().getdata()
self.subject = input("Enter subject: ")

def displayinfo(self):
super().displayinfo()
print(f"Subject: {self.subject}")

class Student(Person):
def __init__(self):
super().__init__()
self.roll_number = ""

def getdata(self):
super().getdata()
self.roll_number = input("Enter roll number: ")

def displayinfo(self):
super().displayinfo()
print(f"Roll Number: {self.roll_number}")

class Application:
def __init__(self):
self.students = [Student() for _ in range(5)]
self.teachers = [Teacher() for _ in range(3)]

def input_data(self):
print("\nEnter Student Data:")
for i, student in enumerate(self.students):
print(f"\nStudent {i + 1}:")
student.getdata()

print("\nEnter Teacher Data:")


for i, teacher in enumerate(self.teachers):
print(f"\nTeacher {i + 1}:")
teacher.getdata()
def search_student(self, name):
return any(student.name == name for student in self.students)

def search_teacher(self, name):


return any(teacher.name == name for teacher in self.teachers)

def display_all(self):
print("\nAll Students Information:")
for student in self.students:
student.displayinfo()

print("\nAll Teachers Information:")


for teacher in self.teachers:
teacher.displayinfo()

# Main Execution
app = Application()
app.input_data()

search_name = input("\nEnter student name to search: ")


print("Student Found!" if app.search_student(search_name) else "Student Not Found.")

search_name = input("Enter teacher name to search: ")


print("Teacher Found!" if app.search_teacher(search_name) else "Teacher Not Found.")

app.display_all()

You might also like