Create a new Python file in your project named FullName.py. In this module, create a class named FullName. When creating a FullName object, the client will pass a string for first name and a string for last name, which the constructor will assign to two attributes. Your class should have the following methods: __init__, __str__, and __gt__. __gt__ will compare two FullName objects using the following logic: If person A’s last name comes after person B’s last name alphabetically, person A is “greater than” person B. If their last names are equal, check their first names to see which is greater. Hint: The > and < operators are already overloaded for string objects, so your __gt__ method should be relatively simple. In your main.py file, demonstrate creating a few FullName objects and calling these methods on them.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 8E
icon
Related questions
Question
  • Create a new Python file in your project named FullName.py. 
  • In this module, create a class named FullName. 
  • When creating a FullName object, the client will pass a string for first name and a string for last name, which the constructor will assign to two attributes. 
  • Your class should have the following methods: __init__, __str__, and __gt__. 
  • __gt__ will compare two FullName objects using the following logic: 
    • If person A’s last name comes after person B’s last name alphabetically, person A is “greater than” person B. 
    • If their last names are equal, check their first names to see which is greater.
    • Hint: The > and < operators are already overloaded for string objects, so your __gt__ method should be relatively simple. 

In your main.py file, demonstrate creating a few FullName objects and calling these methods on them.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Study of Characters
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
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:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT