logo CodeStepByStep logo

Name

Language/Type: Python classes

Write a class named Name where each object remembers information about a person's full name. You must include the following public members:

member name type description
Name(first, middle, last) constructor constructs a new name with the given first name, middle initial, and last name
n.first_name property get/set the first name as a string
n.middle_initial property get/set the middle initial as a string
n.last_name property get/set the last name as a string
n.get_normal_order() method returns the name in normal order such as "John Q. Public"
n.get_reverse_order() method returns the name in reverse order such as "Public, John Q."
str(n) method returns the name in normal order such as "John Q. Public" (same order as get_normal_order).

You should define the entire class including the class heading, the private instance variables, and the declarations and definitions of all the public member functions and constructor.

Class: Write a complete Python class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.