Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal: Implement and test the Student class as shown in the Student/OnlineStudent UML Diagram. Relevant Examples: Person Pet The Card class from Project 3. Details:

image text in transcribed

  • Goal: Implement and test the Student class as shown in the Student/OnlineStudent UML Diagram.
  • Relevant Examples: Person Pet The Card class from Project 3.
  • Details:
    1. Implement the Student class in the module student.py as specified by the Student/OnlineStudent UML Diagram.
    2. Write the traditional test script test1.py and unit test script test2.py that test all of the instance variables and methods in the Student class. Test these instance members in this suggested order:
      __init__ __str__ __repr__ username first_name last_name phone year update_year 
    3. Reminder: test the __init__ method by calling the constructor, which creates a Student object:
      s = Student("1111", "Carter", "Marilyn", "312/473-4837", 1) 
    4. The __init__ method should validate the year. If the input parameter yr is less than 1, set the instance variable year to 1; if yr > 4, set self.year to 4; if 1
    5. The update_year method updates the year, but only if the year is less than 4: if year
    6. Test the __str__ method by calling the standalone str method. If s is a Student object,
      print(str(s)) 
      or
      print(s) 
      (str is automatically called when s is printed).
    7. Test the __repr__ method by calling the standalone repr method like you did for the str method.
    8. To test the instance variables, just print each of their values, for example:
      print(s.username) 
    9. Convert your traditional test script test1.py into a unit test script test2.py.
    10. Remember that the str method must be called explicity when testing it, for example:
      self.assertEqual(str(s), \ "1111 Carter Marilyn 312/473-4837 1")
Student +username int +last_name: str +first_name str +phone str + year: int _init_(self: Student, i: int, last: str, first: str, ph:str, yr: int) _str_(self: Student) _repr__(self: Student) +update_year(self Student) Online Student +email:str + study_group: strl] -init-(self: OnlineStudent, i : int, lapt : str, first: str. ph : str, yr : int, em : str) -_str_(self: OnlineStudent) _repr__(self: OnlineStudent) lt-(self. OnlineStudent, other. OnlineStudent) + add group member self: OnlineStudent, member id: int)

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

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

3. Review the evidence. Do you believe the testimony presented?

Answered: 1 week ago

Question

1. What are the marketing implications of this situation?

Answered: 1 week ago