course): rloads or signing up for lf.courses and len(self.. nd(course) f):

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
class Student:
def _init_(self, firstname, lastname, idnum):
self.first = firstname
self.last = lastname
self.id = idnum
self.courses = []
def add_course(self, course):
''' don't allow overloads or signing up for the same course twice
if course not in self.courses and len(self.courses) < 5:
self.courses.append (course)
def clear_courses(self):
''clear this student's course schedule''"
self.courses = []
def overload (self):
return len(self.courses) >= 4
What are all of the attributes of this class?
last
overload
idnum
add_course
self
first
course
firstname
courses
id
clear_courses
lastname
Transcribed Image Text:class Student: def _init_(self, firstname, lastname, idnum): self.first = firstname self.last = lastname self.id = idnum self.courses = [] def add_course(self, course): ''' don't allow overloads or signing up for the same course twice if course not in self.courses and len(self.courses) < 5: self.courses.append (course) def clear_courses(self): ''clear this student's course schedule''" self.courses = [] def overload (self): return len(self.courses) >= 4 What are all of the attributes of this class? last overload idnum add_course self first course firstname courses id clear_courses lastname
Consider the following code that uses the Student class:
s1 = Student ("Andy","Exley", 1823204)
s2 = Student ("Nate","Taylor", 2413225)
s3 = Student ("Maria", "Tomlin", 1178392)
s1. add_course("CSCI5511")
s2. add_course("CSCI2021")
s1. add_course("LING5105")
students = [s1, s2, s3]
for s in students:
s.add_course("CSC1133")
s.add_course("CSCI8902")
s2. add_course("ENGL2003")
s2. add_course("MUSC2112")
s3.clear_courses ()
Which of the following statements evaluate to True?
len(s1.courses) == 4
s3.clear_courses()
True
==
s2.add_course('CSC14061')
s2.overload()
"CSC11133" in s1.courses
Transcribed Image Text:Consider the following code that uses the Student class: s1 = Student ("Andy","Exley", 1823204) s2 = Student ("Nate","Taylor", 2413225) s3 = Student ("Maria", "Tomlin", 1178392) s1. add_course("CSCI5511") s2. add_course("CSCI2021") s1. add_course("LING5105") students = [s1, s2, s3] for s in students: s.add_course("CSC1133") s.add_course("CSCI8902") s2. add_course("ENGL2003") s2. add_course("MUSC2112") s3.clear_courses () Which of the following statements evaluate to True? len(s1.courses) == 4 s3.clear_courses() True == s2.add_course('CSC14061') s2.overload() "CSC11133" in s1.courses
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT