Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python plz, I need this ASAP, and I will rate this. if the question is not clear let me know. this is the part 1

image text in transcribedimage text in transcribedimage text in transcribed

Python plz,

I need this ASAP, and I will rate this.

if the question is not clear let me know.

this is the part 1 code, plz use this code to create the UML For part 1 and part 2 is the separate quest?

class Student:

# class variable to track the number of student object created

totalEnrollment=0

# constructor to initialize the object

def __init__(self, name, major='IST', status='', active='y',credits=0, qpoints=0):

# incrementing the class variable

Student.totalEnrollment+=1

self.name=name

self.major=major

self.active=active

self.credits=credits

self.qpoints=qpoints

self.g_num="G0000"+str(Student.totalEnrollment)

# method to calculature GPA

def gpa(self):

try:

return self.qpoints/self.credits

except ZeroDivisionError :

return 0

# method to provide the string representation of the object

def __str__(self):

return self.name+", "+self.g_num+", "+self.status()+", "+self.major+", active: "+self.active

+" , credits = "+str(self.credits)+", "+'%.2f' % self.gpa()

# method to check whether the student is active or not

def isactive(self):

if self.active == 'y':

return True

elif self.active == 'n':

return False

else:

pass

# method to get the student status based on the credits

def status(self):

if self.credits

return "Freshman"

elif self.credits > 30 and self.credits

return "Sophomore"

elif self.credits >=60 and self.credits

return "Junior"

elif self.credits >=90:

return "Senior"

else:

pass

# method to check the whether current student object is

# same as the other student object by comparing the g_num

def sameStudent(self,other):

if self.g_num == other.g_num:

return True

else:

return False

def setMajor(self, major):

''' Change the student's major to new value.'''

self.major = major

#department class to examine if the student can enoll in the major

class Department:

''' Class that represents a university department.'''

# Class variable that tracks the number of students in the university.

univ_students = 0

def __init__(self, d_code, d_name, capacity, minGPA):

'''

Constructor to initialize the department object with the given department code, name,

capacity and minGPA requirement.

'''

self.d_code = d_code

self.d_name = d_name

self.capacity = capacity

self.minGPA = minGPA

self.num_students = 0

self.avgGPA = 0

self.studentList = []

def addStudent(self, student):

'''

Add the student to the department if he is qualified and return True + 'Student added'.

If the student is not qualified then return False + 'reason why not added'.

'''

# Check if the student is qualified. If not then return proper error message.

# qualified is a boolean variable which is True if the student is qualified, else False.

qualifed, reason = self.isQualified(student)

if not qualifed:

return qualifed, reason

# Add the student to studentList.

self.studentList.append(student)

# Change the average GPA of department.

self.avgGPA = ((self.avgGPA * self.num_students) + student.gpa()) / (self.num_students + 1)

# Set the student's major to department name.

student.setMajor(self.d_name)

# Update count of students in department.

self.num_students += 1 return True, 'Added'

def isQualified(self, student):

'''

Check if the student is qualified to be added and return True, 'Student is qualified' if

they is qualified, else return False, 'reason why they is not qualified'.

'''

if self.num_students == self.capacity:

return False, 'Over capacity.'

elif student.gpa()

return False, 'Student has lower GPA than required.'

elif student in self.studentList:

return False, 'Student already in studentList.'

elif student.active == 'n':

return False, 'Student is not yet active.'

else:

return True, 'Student is qualified.'

def __str__(self):

''' Return the string representation of the current object. '''

return f'd_code: {self.d_code}, d_name: {self.d_name}, capacity: {self.capacity}, minGPA: {self.minGPA}, num_students: {self.num_students}, avgGPA: {self.avgGPA}'

def showList(self):

print('g_num\tname')

for s in self.studentList:

print(f'{s.g_num}\t{s.name}')

This is a two part assignment. Part 1 requires knowledge of UML, Part 2 knowledge of inheritance. Both parts are due on the above due date. In Part 1 you are to create a UML class diagram for the Department and Student classes created in Assignments 2 and 3. Normally you would create the UML model and then code it, but since this is the first class assignment involving a UML diagram we will use information from a previous assignment with which you should be familiar. While UML is a standard used in various object-oriented projects and can represent code implemented in a number of different 00 languages, there is no standard tool for drawing the diagrams. Microsoft VISIO, for example, includes support for UML drawing, but is expensive to acquire. Drawings can also be rendered in MS PowerPoint, EXCEL, and even Word, but those packages aren't built for that purpose and using in this way them requires some patience. And there are numerous freeware tools such as LucidChart. For this assignment you may choose any of the above or hand draw the diagram on paper and submit a pdf copy of your hand drawn diagram. The diagram should include a complete diagram for the classes and their annotated association correctly shown. Since this is a design assignment there is no executable code to submit and therefore no expected program output. The submission consists of the UML class diagram. As with other aspects of UML, there is not a universally agreed to standard for showing method parameters. For this assignment show method parameters using the class attribute name followed by a colon (":"") and the data type (int, str, etc.). The return type only needs to show the data type returned. The __init_ method can be shown with 'void' or the Class name as the return type since that method creates and returns an object of that class's type. In Part 2 you are to create a UML class diagram showing two classes "Student' and 'Faculty' that extend a parent Person' class. This assignment only requires a diagram to model the classes and their relationship. The next assignment, A5, will code to create Person' and 'Faculty' and modify Student' to inherit from Person'. For the UML model, a generic -Person class is created to hold basic things about a person. The Student class, and a new class named "Faculty', are created subclasses that extend Person. Person will have the following attributes and methods: @ @ Attribute gnum name address telephone email | str str str str str Definition 'g' number identifier individual's name individual's address individual's telephone number individual's email address Method Name Purpose init Constructor - sets initial attribute values in above table. str Displays a readable version of Person: *Person: ' +g num + name + address Input Output/returns See None above@@ None Person data as a printable string Method Name Purpose samePerson Compares "self" Person's g_num and name with the input Person object - returns True if match, otherwise returns False Input Person object Output/returns True if g_num and name match, otherwise False Method Name Purpose Input same Person Compares "self" Person's g_num and name Person with the input Person object - returns True if object match, otherwise returns False Output/returns True if g_num and name match, otherwise False Student and Faculty will inherit the above and be defined as follows: Student: inherits all Person attributes, but adds status, major, enrolled, credits, and qpoints (same as A2) Faculty: inherits all Person attributes, but adds rank, active, teach_load, specialty, funding Student and Faculty both inherit the new samePerson method that does exactly what same Student does, except for a generic Person object that means Student no longer needs its equals method) Student uses the Person constructor, but adds its own attribute definitions as defined in A2, specifically major, enrolled, credits, and qpoints. Faculty uses the Person constructor, but adds its own attribute definitions as follows: @@ Attribute Type Definition rank str valid: {Professor, Associate Professor, Assistant Professor, Instructor} active str is the faculty member active? {y, n} teach load number of credit hours taught per year, range 0 to 24 specialty valid: {teaching, research, administration, combination) funding dollar amount of supported research, range 0 to 10 million Student and Faculty both override the_str_method as follows ("override' will be explained during the Feb 27 or March 4 class): int str int Student returns the string 'Student: * + g_num + name + status + major Faculty returns the string 'Faculty: ' + name + rank + specialty What and where to submit: Submit a pdf version of the UML diagrams, ideally in one pdf file. Standard drawing software and freeware UML drawing tools almost always include the capability to generate a pdf from a diagram. A pdf version of a hand drawn diagrm is also accentable but must be neatly rendered with the text easily readable This is a two part assignment. Part 1 requires knowledge of UML, Part 2 knowledge of inheritance. Both parts are due on the above due date. In Part 1 you are to create a UML class diagram for the Department and Student classes created in Assignments 2 and 3. Normally you would create the UML model and then code it, but since this is the first class assignment involving a UML diagram we will use information from a previous assignment with which you should be familiar. While UML is a standard used in various object-oriented projects and can represent code implemented in a number of different 00 languages, there is no standard tool for drawing the diagrams. Microsoft VISIO, for example, includes support for UML drawing, but is expensive to acquire. Drawings can also be rendered in MS PowerPoint, EXCEL, and even Word, but those packages aren't built for that purpose and using in this way them requires some patience. And there are numerous freeware tools such as LucidChart. For this assignment you may choose any of the above or hand draw the diagram on paper and submit a pdf copy of your hand drawn diagram. The diagram should include a complete diagram for the classes and their annotated association correctly shown. Since this is a design assignment there is no executable code to submit and therefore no expected program output. The submission consists of the UML class diagram. As with other aspects of UML, there is not a universally agreed to standard for showing method parameters. For this assignment show method parameters using the class attribute name followed by a colon (":"") and the data type (int, str, etc.). The return type only needs to show the data type returned. The __init_ method can be shown with 'void' or the Class name as the return type since that method creates and returns an object of that class's type. In Part 2 you are to create a UML class diagram showing two classes "Student' and 'Faculty' that extend a parent Person' class. This assignment only requires a diagram to model the classes and their relationship. The next assignment, A5, will code to create Person' and 'Faculty' and modify Student' to inherit from Person'. For the UML model, a generic -Person class is created to hold basic things about a person. The Student class, and a new class named "Faculty', are created subclasses that extend Person. Person will have the following attributes and methods: @ @ Attribute gnum name address telephone email | str str str str str Definition 'g' number identifier individual's name individual's address individual's telephone number individual's email address Method Name Purpose init Constructor - sets initial attribute values in above table. str Displays a readable version of Person: *Person: ' +g num + name + address Input Output/returns See None above@@ None Person data as a printable string Method Name Purpose samePerson Compares "self" Person's g_num and name with the input Person object - returns True if match, otherwise returns False Input Person object Output/returns True if g_num and name match, otherwise False Method Name Purpose Input same Person Compares "self" Person's g_num and name Person with the input Person object - returns True if object match, otherwise returns False Output/returns True if g_num and name match, otherwise False Student and Faculty will inherit the above and be defined as follows: Student: inherits all Person attributes, but adds status, major, enrolled, credits, and qpoints (same as A2) Faculty: inherits all Person attributes, but adds rank, active, teach_load, specialty, funding Student and Faculty both inherit the new samePerson method that does exactly what same Student does, except for a generic Person object that means Student no longer needs its equals method) Student uses the Person constructor, but adds its own attribute definitions as defined in A2, specifically major, enrolled, credits, and qpoints. Faculty uses the Person constructor, but adds its own attribute definitions as follows: @@ Attribute Type Definition rank str valid: {Professor, Associate Professor, Assistant Professor, Instructor} active str is the faculty member active? {y, n} teach load number of credit hours taught per year, range 0 to 24 specialty valid: {teaching, research, administration, combination) funding dollar amount of supported research, range 0 to 10 million Student and Faculty both override the_str_method as follows ("override' will be explained during the Feb 27 or March 4 class): int str int Student returns the string 'Student: * + g_num + name + status + major Faculty returns the string 'Faculty: ' + name + rank + specialty What and where to submit: Submit a pdf version of the UML diagrams, ideally in one pdf file. Standard drawing software and freeware UML drawing tools almost always include the capability to generate a pdf from a diagram. A pdf version of a hand drawn diagrm is also accentable but must be neatly rendered with the text easily readable

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions