Sample Input 0 Sample Output 0 Enter the number of students: Average weight of all students is 49600.0 g Average energy of all students is 50.0% Average happiness of all students is 65.0%
Sample Input 0 Sample Output 0 Enter the number of students: Average weight of all students is 49600.0 g Average energy of all students is 50.0% Average happiness of all students is 65.0%
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...
Related questions
Question
Kindly refer to the pictures for the instructions
Beginner Level Code:
class Student:
def __init__(self, student_number: int, name: str, weight: float):
self.student_number = student_number
self.name = name
self.weight = weight # in kg
def eat(self, food: str):
# TODO: insert appropriate code here
self.weight += 0.50
print(f"{self.name} ate {food}.")
def exercise(self, exercise: str):
# TODO: insert appropriate code here
self.weight -= 0.50
print(f"{self.name} did {exercise}.")
def get_weight_in_grams(self):
# TODO: insert appropriate code here
return (self.weight * 1000)
# TODO: once done, remove line of code below
#pass
class EEE111Student(Student):
energy_level = 50
happiness_level = 50
def code_python(self):
# TODO: insert appropriate code here
self.energy_level -= 10
self.happiness_level += 10
# TODO: once done, remove line of code below
#pass
def eat(self, food: str):
# TODO: insert appropriate code here
Student.eat(self, food)
self.energy_level += 10
self.happiness_level += 10
# TODO: once done, remove line of code below
#pass
def exercise(self, food: str):
# TODO: insert appropriate code here
Student.exercise(self, food)
self.energy_level -= 10
self.happiness_level += 10
# TODO: once done, remove line of code below
#pass
def display_state(self):
print(
f"Displaying stats for {self.name}, student number: {self.student_number}."
)
print(
f"Energy level: {self.energy_level}, happiness level: {self.happiness_level}, weight: {self.weight}"
)
if __name__ == "__main__":
other_student = Student(student_number=1, name="Juan", weight=50)
eee_student = EEE111Student(student_number=1, name="Joe", weight=50)
other_student.eat("popcorn")
eee_student.eat("rice")
eee_student.eat("adobo")
other_student.exercise("badminton")
eee_student.exercise("volleyball")
eee_student.code_python()
print(f"{other_student.name} weight: {other_student.get_weight_in_grams()} grams")
print(f"{eee_student.name} weight: {eee_student.get_weight_in_grams()} grams")
eee_student.display_state()
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 2 steps with 2 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY