In this assignment you are to write a Python program to define a class to model the characteristics of a university student. The class is part of a slightly larger program that includes code to use the class to create some student objects and test its methods. The name of the class is "Student' and includes the following methods and attributes: Method Name Purpose init str gpa is Enrolled status sameStudent Attribute totalEnrollment g_num name major enrolled credits qpoints Constructor - sets initial attribute values. name is a positional attribute, the others are keyword with default values. g_num is generated as described in the next table. Displays a readable version of the Student object Calculates and returns the student's gpa. gpa-apoints/credits Returns whether the student is currently enrolled. ('y' = True, 'n'=False) Computes class status based on # of credits completed (90+= 'Senior', 60+= "Junior', |30+= 'Sophomore', <30 = "Freshman Compares "self" ("this") student's g_num and name with the input Student object's- returns True if match, otherwise returns False Type int str str str str float float Input/parm See attribute list below@ None None None None Student object (reference id) Output/returns None Student data as a printable string gpa (float) True or False String indicating class status (Senior', etc.) True or False Definition Class level variable that counts number of student objects created for entire class 6 digit Student ID: "G" + + totalEnrollment at the time the student object was created-assigned by the class - range is GO0001, G00002, ..., GO0010, G00011, ...G99999 Student name-", " {"Acctg", "Art", "CSci", "Hist", "IST", "Math", "Physics"} Is this a currently enrolled student? {"y", "n"} Number of accumulated credits to date Number of accumulated quality points to date For your submitted code, in addition to the class definition, include the following global code that tests your class. This code is provided as a separate file with the assignment. Copy and paste it into your submitted code. The code creates Student objects, prints those objects, prints additional information on them using dot-notation access to attributes, and executes methods to calculate other information about students: print("\nStart of A2 Student class demo") sl - Student("David Miller', major-'Hist', enrolled = 'y, credits = 0, qpoints=0) $2 - Student("Sonia Fillmore', major="Math', enrolled = y, credits -90, qpoints=315) $3=Student("A. Einstein', major="Phys', enrolled = 'y, credits = 0, qpoints=0) s4-Student(W. A. Mozart, major="Mus', enrolled = 'n', credits-29, qpoints - 105) s5 - Student("Sonia Fillmore', major = 'CSci', enrolled=y, credits = 60, qpoints=130) s5.g_num=s2.g_num s6 = Student("Pierre Renoir, major="Art", enrolled-y, credits = 120, qpoints=315) print('sl="sl) print('s2, s2) print('s3="s3) print('s4=,4) print('s5,5) print('s6 = ", 56) print("\n Total number of students:", Student totalEnrollment) print("The gpa of", sl.name, 'is', s2.gpa()) print('Class standing of', s4.name, 'is', s4.status()) print('Class standing of", s2.name, 'is', $2.status()) if sl.sameStudent(s2): print (sl.name," and", $2.name," are the same student') else: print (s1.name," and", s2.name," are not the same student') if s2.sameStudent(s5): print (s2.name," and", s5.name, ' are the same student') else: print (s2.name," and", s5.name," are not the same student') if sl.isEnrolled(): print (s1.name," is currently enrolled") else: print (s1.name," is not currently enrolled") if $4.is Enrolled(): print (s4.name," is currently enrolled") else: print fed name is not currently anrolled 1
In this assignment you are to write a Python program to define a class to model the characteristics of a university student. The class is part of a slightly larger program that includes code to use the class to create some student objects and test its methods. The name of the class is "Student' and includes the following methods and attributes: Method Name Purpose init str gpa is Enrolled status sameStudent Attribute totalEnrollment g_num name major enrolled credits qpoints Constructor - sets initial attribute values. name is a positional attribute, the others are keyword with default values. g_num is generated as described in the next table. Displays a readable version of the Student object Calculates and returns the student's gpa. gpa-apoints/credits Returns whether the student is currently enrolled. ('y' = True, 'n'=False) Computes class status based on # of credits completed (90+= 'Senior', 60+= "Junior', |30+= 'Sophomore', <30 = "Freshman Compares "self" ("this") student's g_num and name with the input Student object's- returns True if match, otherwise returns False Type int str str str str float float Input/parm See attribute list below@ None None None None Student object (reference id) Output/returns None Student data as a printable string gpa (float) True or False String indicating class status (Senior', etc.) True or False Definition Class level variable that counts number of student objects created for entire class 6 digit Student ID: "G" + + totalEnrollment at the time the student object was created-assigned by the class - range is GO0001, G00002, ..., GO0010, G00011, ...G99999 Student name-", " {"Acctg", "Art", "CSci", "Hist", "IST", "Math", "Physics"} Is this a currently enrolled student? {"y", "n"} Number of accumulated credits to date Number of accumulated quality points to date For your submitted code, in addition to the class definition, include the following global code that tests your class. This code is provided as a separate file with the assignment. Copy and paste it into your submitted code. The code creates Student objects, prints those objects, prints additional information on them using dot-notation access to attributes, and executes methods to calculate other information about students: print("\nStart of A2 Student class demo") sl - Student("David Miller', major-'Hist', enrolled = 'y, credits = 0, qpoints=0) $2 - Student("Sonia Fillmore', major="Math', enrolled = y, credits -90, qpoints=315) $3=Student("A. Einstein', major="Phys', enrolled = 'y, credits = 0, qpoints=0) s4-Student(W. A. Mozart, major="Mus', enrolled = 'n', credits-29, qpoints - 105) s5 - Student("Sonia Fillmore', major = 'CSci', enrolled=y, credits = 60, qpoints=130) s5.g_num=s2.g_num s6 = Student("Pierre Renoir, major="Art", enrolled-y, credits = 120, qpoints=315) print('sl="sl) print('s2, s2) print('s3="s3) print('s4=,4) print('s5,5) print('s6 = ", 56) print("\n Total number of students:", Student totalEnrollment) print("The gpa of", sl.name, 'is', s2.gpa()) print('Class standing of', s4.name, 'is', s4.status()) print('Class standing of", s2.name, 'is', $2.status()) if sl.sameStudent(s2): print (sl.name," and", $2.name," are the same student') else: print (s1.name," and", s2.name," are not the same student') if s2.sameStudent(s5): print (s2.name," and", s5.name, ' are the same student') else: print (s2.name," and", s5.name," are not the same student') if sl.isEnrolled(): print (s1.name," is currently enrolled") else: print (s1.name," is not currently enrolled") if $4.is Enrolled(): print (s4.name," is currently enrolled") else: print fed name is not currently anrolled 1
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Concept explainers
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Question
python
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education