Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you are asked to write a Python program to define a class to model some characteristics of a university Department. Specifically, the

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

In this assignment you are asked to write a Python program to define a class to model some characteristics of a university Department. Specifically, the class will track students requesting to major in that particular department. Students will be represented by student objects created using the Student class developed in A2 When an attempt is made to add the student to a department's major (program), the Department class will examine the Student object data and decide whether to add them to the major. If not, the class returns a response indicating rejection with a short reason why. The Department class should have, at minimum, the following methods (you may add others) Method Name Purpose Input Output/returns None Constructor - sets initial attribute values. d code and d _name are positional attributes, below@a the others are keyword with default values Displays a readable version of the Department |None object nit str Student data asa rintable string addStudentAdds qualified students to the department's Student True (added) roster of majors. Uses isQualified internalobject method to return whether qualified. False(not added)+reason isQualifiedReturns whether the student is qualified forStudentTrue (qualified) or obiect this major Prints a list of Students listed as majoring inNone this department's program False (not)+reason List of students majoring in department's program printR oster a a Attribute d code d name capaci minGPA Tvpe Definition Department code - 4 char str - valid: {ENGR, ARTS, CHHS Department name- str Maximum number of students allowed to maior in the department Incoming student's gpa must be greater than or equal to this Total number of students listed as majors for the Department object Total number of students listed as majors in all departments Average gpa of all students in department listed as its majors List containing student objects of those majoring in this department str num students univ students avgGPA roster int float List The following table shows the allowed values for each of the three Department objects Type Initial value str Attribute d code d name ARTS ARTS Art and Architecture ENGR CHHS CHHS College of Health and Human Services 10 Constructor parm. ENGR Constructor parm. Engineering capacity int Set up by in init deptartment> minGPA float Set up in init , 2.75 2.0 2.50 by department ARTS | | | Type Initial value Attribute num studentsint univ_students int avgGPA roster ENGR current value> List of student objects CHHS Current value> 0 0 float | None-calculated List Empty list List of student List of student objects objects Below is the functionality of the required methods: Method Name All Departments ENGR-only ARTS-only CHHS-only Constructor - initial attribute values 1. univ_students 0 (value shared ENGR d code- d code ARTS nit d code= CHHS name-'Art d name by all objects) d name- 'Engineering'and capacity -5Architecture'Health and 2. capacity and minGPA set up 'College of according to department specifications capacity- 15Human Services 3. num students-0 capacity 10 CHHS-only Method Name All Departments ENGR-only ARTS-only CH capacity, duplicate, not enrolled printRoster Prints a list of all Students (g_num and name) listed as majoring in this department's program. To create and test the Student class do the following: 1. Create three Department classes as described above (one per department) and include the Student class 2. Within the program, use the assignment operator to create and print enough student objects to test and 3. Add each of the created students into one of the three Department class objects using the addStudent from A2 to create student objects. Create a 'setMajor' method for Student so the Department class can update it when a student object is successfully added to the major. demonstrate the Department class capabilities. Probably 8-12 students are adequate. At least one set should completely fill a department capacity so the over capacity' rejection capability can be exercised. 4. 5. method Attempt to add a student to a Department that is already on that Department's roster. Use the printRoster method to display a list of students in that department In this assignment you are asked to write a Python program to define a class to model some characteristics of a university Department. Specifically, the class will track students requesting to major in that particular department. Students will be represented by student objects created using the Student class developed in A2 When an attempt is made to add the student to a department's major (program), the Department class will examine the Student object data and decide whether to add them to the major. If not, the class returns a response indicating rejection with a short reason why. The Department class should have, at minimum, the following methods (you may add others) Method Name Purpose Input Output/returns None Constructor - sets initial attribute values. d code and d _name are positional attributes, below@a the others are keyword with default values Displays a readable version of the Department |None object nit str Student data asa rintable string addStudentAdds qualified students to the department's Student True (added) roster of majors. Uses isQualified internalobject method to return whether qualified. False(not added)+reason isQualifiedReturns whether the student is qualified forStudentTrue (qualified) or obiect this major Prints a list of Students listed as majoring inNone this department's program False (not)+reason List of students majoring in department's program printR oster a a Attribute d code d name capaci minGPA Tvpe Definition Department code - 4 char str - valid: {ENGR, ARTS, CHHS Department name- str Maximum number of students allowed to maior in the department Incoming student's gpa must be greater than or equal to this Total number of students listed as majors for the Department object Total number of students listed as majors in all departments Average gpa of all students in department listed as its majors List containing student objects of those majoring in this department str num students univ students avgGPA roster int float List The following table shows the allowed values for each of the three Department objects Type Initial value str Attribute d code d name ARTS ARTS Art and Architecture ENGR CHHS CHHS College of Health and Human Services 10 Constructor parm. ENGR Constructor parm. Engineering capacity int Set up by in init deptartment> minGPA float Set up in init , 2.75 2.0 2.50 by department ARTS | | | Type Initial value Attribute num studentsint univ_students int avgGPA roster ENGR current value> List of student objects CHHS Current value> 0 0 float | None-calculated List Empty list List of student List of student objects objects Below is the functionality of the required methods: Method Name All Departments ENGR-only ARTS-only CHHS-only Constructor - initial attribute values 1. univ_students 0 (value shared ENGR d code- d code ARTS nit d code= CHHS name-'Art d name by all objects) d name- 'Engineering'and capacity -5Architecture'Health and 2. capacity and minGPA set up 'College of according to department specifications capacity- 15Human Services 3. num students-0 capacity 10 CHHS-only Method Name All Departments ENGR-only ARTS-only CH capacity, duplicate, not enrolled printRoster Prints a list of all Students (g_num and name) listed as majoring in this department's program. To create and test the Student class do the following: 1. Create three Department classes as described above (one per department) and include the Student class 2. Within the program, use the assignment operator to create and print enough student objects to test and 3. Add each of the created students into one of the three Department class objects using the addStudent from A2 to create student objects. Create a 'setMajor' method for Student so the Department class can update it when a student object is successfully added to the major. demonstrate the Department class capabilities. Probably 8-12 students are adequate. At least one set should completely fill a department capacity so the over capacity' rejection capability can be exercised. 4. 5. method Attempt to add a student to a Department that is already on that Department's roster. Use the printRoster method to display a list of students in that department

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

Create a structural model for exercise E in Chapter 5.

Answered: 1 week ago

Question

In bargaining, does it really matter who makes the first offer?

Answered: 1 week ago