entation, you can assume all parameters wil be passed in and no defaut ded. Note: the Student constructor must utilze the Person constructor in ane and weight values correctly serited Person class' getinfo method when constructing the retum string A constructor that sets the Person's name and weight to th should be set to the name and e should be set to the weig values are used when the object is being constructed. nod must explicitly call the Person class' getInfo method when e return string operator such that student objecti student object2 returns True ecti has a perm value greater than or equal to student object2s perm • setNane method that updates the Person's nane. • setweight method that updates the Person's weight. • getInfo method that returns a string containing the Persor ms False otherwise (see example assert statements below) statements below for the specific format of the string that th additional methods except the ones described above • The class should support deep equality, which returns Tru definition must be syntactically correct in order to receive full credit: weight values are equal. emented corecty, then the folowing assert statements should pass Note: your class definition must be syntactically correct i e "Peter Parker", 167, 1234567) Plash Thonpson", sie, 7654321) f your class is implemented correctly, then the following asse Infol) Peter Parker, Weight: 167, PERM: 1234547 Infol) Flash Thoneson, weighti 10, PER 7654321 s2) False s) True pl = Person("Thor", 250) p2- Person(0 assert pl.nane "Thor" assert pl.weight 250 assert p2.nane ** assert p2.weight e ver here

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write the entire class definition for a Person class that contains the following attributes:
Assuming your definition of the Person class is complete in Question 4, in the space below
• name - a str value representing the Person's name.
• weight - an int value representing the weight of the Person (in Ibs, but this metric is
write the definition for a Student class that inherits from the Person class. The Student class
must
irrelevant for this problem).
• contain an additional int attribute named pern.
• define its own constructor that takes in a name (str), weight (inti, and perm (int) parameters.
For this implementation, you can assume all parameters will be passed in and no default
Your class definition should contain the following methods and correct behavior:
• A constructor that sets the Person's name and weight to the object. An empty string (*)
values are needed. Note: the Student constructor must utilize the Person constructor in
order to set the nane and weight values correctly.
should be set to the name ande should be set to the weight if no name and weight
• override the inherited Person class' get Info method when constructing the return string
values are used when the object is being constructed.
Note: this method must explicitly call the Person class' getInfo method when
• setNane method that updates the Person's name.
• setweight method that updates the Person's weight.
• getInfo method that returns a string containing the Person's information (see assert
constructing the return string.
• overload the operator such that student_objecti student object2 returns True
if student_objecti has a perm value greater than or equal to student_object2's perm
value, and returns False otherwise (see example assert statements below).
statements below for the specific format of the string that this method returns).
• not define any additional methods except the ones described above.
• The class should support deep equality, which returns True if the Person's name and
Note: your class definition must be syntactically correct in order to receive full credit):
weight values are equal.
f your class is implemented correctly, then the following assert statements should pass:
Note: your class definition must be syntactically correct in order to receive full credit.
$1- Student ("Peter Parker", 167, 1234567)
s2 = Student ("Flash Thonpson", 160, 7654321)
If your class is implemented correctly, then the following assert statements below should pass.
assert s1.getInfo() =
"Name: Peter Parker, Weight: 167, PERM: 1234567"
pl = Person("Thor", 250)
p2- Person()
assert s2.getInfol) ==\
"Nane: Flash Thompson, Weight: 160, PERM: 7654321"
assert (sl > s2) False
assert (s2 s1) True
assert pl.name "Thor"
assert pl.weight = 250
assert p2.name ==
assert p2.weight = e
assert pl.getinfo() == "Name: Thor, Weight: 250"
assert p2.get Info() = "Name:, Weight: 0"
assert (pl p2) False
p2. setName("Thor")
Enter your answer here
assert (pl p2) True
Enter your answer here
Transcribed Image Text:Write the entire class definition for a Person class that contains the following attributes: Assuming your definition of the Person class is complete in Question 4, in the space below • name - a str value representing the Person's name. • weight - an int value representing the weight of the Person (in Ibs, but this metric is write the definition for a Student class that inherits from the Person class. The Student class must irrelevant for this problem). • contain an additional int attribute named pern. • define its own constructor that takes in a name (str), weight (inti, and perm (int) parameters. For this implementation, you can assume all parameters will be passed in and no default Your class definition should contain the following methods and correct behavior: • A constructor that sets the Person's name and weight to the object. An empty string (*) values are needed. Note: the Student constructor must utilize the Person constructor in order to set the nane and weight values correctly. should be set to the name ande should be set to the weight if no name and weight • override the inherited Person class' get Info method when constructing the return string values are used when the object is being constructed. Note: this method must explicitly call the Person class' getInfo method when • setNane method that updates the Person's name. • setweight method that updates the Person's weight. • getInfo method that returns a string containing the Person's information (see assert constructing the return string. • overload the operator such that student_objecti student object2 returns True if student_objecti has a perm value greater than or equal to student_object2's perm value, and returns False otherwise (see example assert statements below). statements below for the specific format of the string that this method returns). • not define any additional methods except the ones described above. • The class should support deep equality, which returns True if the Person's name and Note: your class definition must be syntactically correct in order to receive full credit): weight values are equal. f your class is implemented correctly, then the following assert statements should pass: Note: your class definition must be syntactically correct in order to receive full credit. $1- Student ("Peter Parker", 167, 1234567) s2 = Student ("Flash Thonpson", 160, 7654321) If your class is implemented correctly, then the following assert statements below should pass. assert s1.getInfo() = "Name: Peter Parker, Weight: 167, PERM: 1234567" pl = Person("Thor", 250) p2- Person() assert s2.getInfol) ==\ "Nane: Flash Thompson, Weight: 160, PERM: 7654321" assert (sl > s2) False assert (s2 s1) True assert pl.name "Thor" assert pl.weight = 250 assert p2.name == assert p2.weight = e assert pl.getinfo() == "Name: Thor, Weight: 250" assert p2.get Info() = "Name:, Weight: 0" assert (pl p2) False p2. setName("Thor") Enter your answer here assert (pl p2) True Enter your answer here
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY