Question

A university is a very busy place with a lot of students and also a lot...

  1. A university is a very busy place with a lot of students and also a lot of employees to keep the system running perfectly. All people in the university have basic information like name, address, email and phone number. Employees at the university have extra information like employee-id and salary. There are also faculty and staff who are employees at the university. Each faculty has a designation and is assigned to a specific college and has number of courses taught. Each staff belongs to a specific department such as IT, HR etc. and has a designation at the department. Then, there are students who have the information such as Courses taken, GPA etc.

    You are required to draw the UML Class diagram and create Python classes to represent the different types of people at a university. Identify the classes and the relationships between them. Implement the classes in Python. Create a separate test module where instances of the class are created, and the methods are tested by creating a list of different people at the university and displaying their information.

(DRAW UML AND CREATE PYTHON) WITH comments and screenshots please

Homework Answers

Answer #1

Hey! here is my code and output with screen shorts... to appreciate my work please give positive feedback ...this code take so much time.....

Code:

# Base class
class Person:
    name = ""
    address = ""
    email = ""
    phone = 0

    def __init__(self, pname, paddress, pemail, pphone):
        self.name = pname
        self.address = paddress
        self.email = pemail
        self.phone = pphone

    # Function to display student details
    def display(self):
        print("Name   : ", self.name)
        print("Address : ", self.address)
        print("Email : ", self.email)
        print("phone no  : ", self.phone)


# parent class for faculty and student child class
class Courses:
    course_name = []
    course_code = []

    def __init__(self, c_name, c_code):
        self.course_name = c_name
        self.course_code = c_code

    def display(self):
        print("Course name : ", ",".join(self.course_name))
        print("Course code : ", ",".join(self.course_code))


# parent class for Staff child class
class Department:
    department_name = ""

    def __init__(self, d_name):
        self.department_name = d_name

    def display(self):
        print("Department name : ", self.department_name)


# parent class for student and staff child class
class College:
    college_name = ""
    college_code = 0
    college_address = ""

    def __init__(self, code, name, address):
        self.college_code = code
        self.college_name = name
        self.college_address = address

    def display(self):
        print("College Code : ", self.college_code)
        print("College name : ", self.college_name)
        print("College Address : ", self.college_address)


# child class inherit person, course, college class
class Student(Person, Courses, College):
    student_rn = 0
    student_GPA = 0

    def __init__(self, rollno, GPA, pname, paddress, pemail, pphone, c_name, c_code, code, name, address):
        self.student_rn = rollno
        self.student_GPA = GPA
        Person.__init__(self, pname, paddress, pemail, pphone)
        Courses.__init__(self, c_name, c_code)
        College.__init__(self, code, name, address)

    def display(self):
        Person.display(self)
        print("RollNo : ", self.student_rn)
        print("Email : ", self.student_GPA)
        Courses.display(self)
        College.display(self)


# child class inherit person
class Employee(Person):
    em_id = ""
    em_salary = 0

    def __init__(self, id, salary, pname, paddress, pemail, pphone):
        Person.__init__(self, pname, paddress, pemail, pphone)
        self.em_id = id
        self.em_salary = salary

    def display(self):
        print("Employee id : ", self.em_id)
        Person.display(self)
        print(f"Employee salary : {self.em_salary} ")


# child class inherit Employee, course, college class
class Faculty(Employee, College, Courses):
    faculty_designation = ""

    def __init__(self, id, salary, pname, paddress, pemail, pphone, designation, c_name, c_code, code, name, address):
        Employee.__init__(self, id, salary, pname, paddress, pemail, pphone)
        Courses.__init__(self, c_name, c_code)
        College.__init__(self, code, name, address)
        self.faculty_designation = designation

    def display(self):
        Employee.display(self)
        print("Faculty Designation : ", self.faculty_designation)
        Courses.display(self)
        College.display(self)


# child class inherit Employee, Department class
class Staff(Employee, Department, ):
    staff_designation = ""

    def __init__(self, id, salary, pname, paddress, pemail, pphone, designation, d_name):
        Employee.__init__(self, id, salary, pname, paddress, pemail, pphone)
        Department.__init__(self, d_name)
        self.staff_designation = designation

    def display(self):
        Employee.display(self)
        print("Staff Designation : ", self.staff_designation)
        Department.display(self)


# main code that drive the program
if __name__ == '__main__':
    print("********************Student Data***************************")
    s1 = Student(515607217, 9, "shweta", "XYZ 1101", "[email protected]", 123456786, ["Computer Science"], ['127'], 156, "XYZE",
                 "E=123 ABC")
    s1.display()
    print("\n********************Faculty Member Data*************************")
    f1 = Faculty(23024, 50000, "Mr. john smith", "ABCD 1101", "[email protected]", 9625487425, "Assistant Professor",
                 ['Chemistry', 'Commerce'], ['458','890'], 156, "XYZE", "E=123 ABC")
    f1.display()

    print("\n********************Staff Member Data*************************")
    staff1 = Staff(12085, 30000, "Mrs.Sina", "xyzs E-897", "[email protected]", 4578123695,
                   "Assistant", "IT")
    staff1.display()

Output:-

UML Daigram:-

thanks............for any query related to code .....please ask me......and give positive Rating ...

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
A university is a very busy place with a lot of students and also a lot...
A university is a very busy place with a lot of students and also a lot of employees to keep the system running perfectly. All people in the university have basic information like name, address, email and phone number. Employees at the university have extra information like employee-id and salary. There are also faculty and staff who are employees at the university. Each faculty has a designation and is assigned to a specific college and has number of courses taught....
A University wants to create an ER Diagram for its business model in the blank space...
A University wants to create an ER Diagram for its business model in the blank space provided below It provides the following business rules. All the relationship and cardinalities need to be shown properly based on the business rules given below. Any assumptions you make should be clearly mentioned. Students can take many courses but will need to take at least one course. Courses will have at least one but likely many students. Student can rent up to 3 books...
You are a forensic accountant and just been hired by MacEwan University (“MU”) to investigate possible...
You are a forensic accountant and just been hired by MacEwan University (“MU”) to investigate possible fraud relating to parking revenue. Your first task is to deal with a pressing issue related to the controls in the new parking access system for the new parking lot (this is the first time the university will charge for parking). MNU has signed an agreement with All Access Inc (AAI), a third-party service provider, to lease the parking access system for three years....
Project 2 statement Please write this in JAVA. Please read this entire statement carefully before you...
Project 2 statement Please write this in JAVA. Please read this entire statement carefully before you start doing anything… This project involves implementing a simple university personnel management program. The program contains two different kinds of objects: students and faculty. For each object, the program stores relevant information such as university ID, name, etc. Different information is stored depending on the type of the object. For example, a student has a GPA, while a faculty has a title and department...
can anyone please paraphrase the below passege and also add some information about smartclass and how...
can anyone please paraphrase the below passege and also add some information about smartclass and how is the relationship between smart class and special need people? for example, how smartclass can help disabled people to study well and reach their goals? Smart Class is a solution designed to help teachers in meeting with new challenges and developing students abilities and performance. It helps the teachers to access multimedia content and information ,that can be used for teaching students more effectively....
Students Learn the Hard Way News Story In most states, tuition is going up in four-year...
Students Learn the Hard Way News Story In most states, tuition is going up in four-year public universities. Most are in the single digits, but some are huge - freshmen at Texas A&M will pay 26 percent more, University of Kansas students 21 percent, and University of South Carolina students 17 percent. The culprit is reduced state funding. The weaker economy has decreased tax revenues, and so states have cut spending to balance their budgets. Higher education is easier to...
You are hired to design a database for a fitness center. As the fitness center is...
You are hired to design a database for a fitness center. As the fitness center is expanding with more than one branch, they want to create a database to keep track of its customers, facilities and employees. Each branch has a unique id and address (building number, street, district, and city). A branch may have more than one facility (e.g. swimming pool, spa, etc.). Each facility must belong to only one branch, and the information for a facility is name...
Complete ER Diagrams for each scenario given (ignore the fact that the problem says "class diagram"...
Complete ER Diagrams for each scenario given (ignore the fact that the problem says "class diagram" - do an ER diagram like we've been doing in class).   8.99 (do a, b, and c) 8.99 a. Draw a class diagram, showing the relevant classes, attributes, operations, and relationships for each of the following situations (if you believe that you need to make additional assumptions, clearly state them for each situation): a. A company has a number of employees. The attributes of...
What were the main findings of this research (i.e., did the analyses support or fail to...
What were the main findings of this research (i.e., did the analyses support or fail to support the researchers’ hypotheses?). (The answer to this question can be found by reading the “Discussion” section of the article, especially the first few paragraphs). and this is the Discussion : Today’s students are quite different than those who populated university classrooms at the turn of the century. Raised in the internet age, constantly “plugged in”, seemingly inextricably attached to cell phones, and facile...
Item Chapter 5 Planning Programs that Prevent Discipline Problems Quote of the Day #1: You can...
Item Chapter 5 Planning Programs that Prevent Discipline Problems Quote of the Day #1: You can discover more about a person in an hour of play than in a year of conversation. Plato This chapter focuses on planning programs that prevent discipline problems. I consider myself a "constructivist teacher". I think students learn best when the information is meaningful to them and the process engages their curiosity and exploration. I want to encourage students to explore ideas and develop them,...