Create an address class that contains the following


For all parts you must:

Write a Python (.py) program

Test, debug, and execute the Python program

Submit a copy of your commented source code on-line

1. A) Create an Address class that contains the following instance variables: street, city, state and zipcode Provide a constuctor that initializes all four instance variables with data passed to the constructor.

Add a __str__ method that returns a string printing the instance variables. Provide methods that allows you to get and set all four instance variables. Demonstrate the correctness of your program with a couple sample test cases.

B) Create an Person class that contains the following instance variables: name, phone, and address where composition of the Address class is used for the address instance variable.

Provide a constuctor that initializes all three instance variables with the data passed to the constructor. Provide methods that allow you to get and set the name and phone instance variables. (Note: You do not need to provide these for the address instance variable because you are using composition). Demonstrate the correctness of your program with a couple sample test cases.

C) Create a Student class that utilizes inheritance to make a derived class of the Person class. This class should add the following instance variables: id, hours, and qpoints.

The class should contain a constructor method that utilizes the Student constructor. Provide methods that allow you to get and set the id, hours and qpoints instance variables. Demonstrate the correctness of your program with a couple sample test cases.

D) Add the following methods to the Student class your created in the previous problem:

-grade_level - returns the current grade level of a student (1 = less than 30 credits, 2 = 30-59 credits, 3 = 60-89 credits, 4 = 90 or more credits)

-display_gpa - calcuates and returns a student's gpa based on their hours and qpoints

-add_grade - modifies a students hours and qpoints based on provided course grade ('A','B','C','D','F') and the credits associated with that grade.

Demonstrate the correctness of your program with a couple sample test cases.

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Create an address class that contains the following
Reference No:- TGS02885047

Expected delivery within 24 Hours