2. Design a Destroyer and Person class so the following driver code generates the given output upon execution. A Person has only "name" as its property which is publicly accessible and has a few public functions. All the properties (or variables) of a Destroyer object, on the other hand, are private. The variables are chars - a string containing all the characters that a particular Destroyer object will remove from a Person's name and replace_chars - a string with which each character in chars will be replaced from a Person's name. You may use the class diagram given below. Destroyer -chars: str -replace_chars: str _init(): None Driver Code: john Person ("John") alberta = Person ("Alberta") print (john, alberta) 0: Person v_kill= Destroyer ("aeiou") v_kill (john) print (john, alberta) print (caitlin) v_kill (caitlin).show_name() alberta.show_name() Alberta Alberta Ciin ON Output: John Alberta Destroyed: 'o' from Jihn's name. Jähn Alberta Jhn Alberta alpha_kill= Destroyer ("".join(chr(i) for i in range (65, 91)), "") print (john, alberta) alpha_kill (john) print (john, alberta) alberta.push_name (john) print (john, alberta) caitlin = Person ("Caitlin") john.attack (caitlin) Destroyed: 'h', 'j', 'n' from #'s name. # Alberta ON Destroyed: 'i' from C##n's name. Hello, I am C# #n Hello, I am Alberta Person name str _init__(): None _str_0 str +push_name(): None + pull_name(): None show_name(): None attack(): None
2. Design a Destroyer and Person class so the following driver code generates the given output upon execution. A Person has only "name" as its property which is publicly accessible and has a few public functions. All the properties (or variables) of a Destroyer object, on the other hand, are private. The variables are chars - a string containing all the characters that a particular Destroyer object will remove from a Person's name and replace_chars - a string with which each character in chars will be replaced from a Person's name. You may use the class diagram given below. Destroyer -chars: str -replace_chars: str _init(): None Driver Code: john Person ("John") alberta = Person ("Alberta") print (john, alberta) 0: Person v_kill= Destroyer ("aeiou") v_kill (john) print (john, alberta) print (caitlin) v_kill (caitlin).show_name() alberta.show_name() Alberta Alberta Ciin ON Output: John Alberta Destroyed: 'o' from Jihn's name. Jähn Alberta Jhn Alberta alpha_kill= Destroyer ("".join(chr(i) for i in range (65, 91)), "") print (john, alberta) alpha_kill (john) print (john, alberta) alberta.push_name (john) print (john, alberta) caitlin = Person ("Caitlin") john.attack (caitlin) Destroyed: 'h', 'j', 'n' from #'s name. # Alberta ON Destroyed: 'i' from C##n's name. Hello, I am C# #n Hello, I am Alberta Person name str _init__(): None _str_0 str +push_name(): None + pull_name(): None show_name(): None attack(): None
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
it would be helpful if the code could be in a litle bit easy and no high level funtions not to be used
![2. Design a Destroyer and Person class so the following driver code generates the given output upon
execution.
A Person has only 'name' as its property which is publicly accessible and has a few public functions.
All the properties (or variables) of a Destroyer object, on the other hand, are private. The variables are
chars - a string containing all the characters that a particular Destroyer object will remove from a
Person's name and replace_chars - a string with which each character in chars will be replaced from
a Person's name. You may use the class diagram given below.
Destroyer
-chars: str
-replace_chars: str
_init_(): None
call (): Person
Driver Code:
john Person ("John")
alberta
print (john, alberta)
v_kill= Destroyer ("aeiou")
v_kill (john)
print (john, alberta)
Person ("Alberta")
alpha_kill (john)
print (john, alberta)
alberta.push_name (john)
print (john, alberta)
caitlin = Person ("Caitlin")
john.attack (caitlin)
print (caitlin)
v kill (caitlin).show_name()
alberta.show_name()
0...N
Alberta Alberta
Ciin
alpha_kill= Destroyer ("".join(chr(i) for i in range (65, 91)), **)
print (john, alberta).
Output:
John Alberta
Destroyed: 'o' from Jihn's name.
Jahn Alberta
Jihn Alberta
Destroyed: 'h', 'j', 'n' from #'s name.
# Alberta
0.N
Destroyed: 'i' from C##n's name.
Hello, I am C# #n
Hello, I am Alberta
Person
+ name: str
_init(): None
_str(): str
+ push_name(): None
+ pull_name(): None
+ show_name(): None
+ attack(): None](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb9dda2e0-e8fc-498d-9ab0-60503868f336%2Fb07f5cda-3190-4663-8a35-242262925f40%2F0x12lfr_processed.jpeg&w=3840&q=75)
Transcribed Image Text:2. Design a Destroyer and Person class so the following driver code generates the given output upon
execution.
A Person has only 'name' as its property which is publicly accessible and has a few public functions.
All the properties (or variables) of a Destroyer object, on the other hand, are private. The variables are
chars - a string containing all the characters that a particular Destroyer object will remove from a
Person's name and replace_chars - a string with which each character in chars will be replaced from
a Person's name. You may use the class diagram given below.
Destroyer
-chars: str
-replace_chars: str
_init_(): None
call (): Person
Driver Code:
john Person ("John")
alberta
print (john, alberta)
v_kill= Destroyer ("aeiou")
v_kill (john)
print (john, alberta)
Person ("Alberta")
alpha_kill (john)
print (john, alberta)
alberta.push_name (john)
print (john, alberta)
caitlin = Person ("Caitlin")
john.attack (caitlin)
print (caitlin)
v kill (caitlin).show_name()
alberta.show_name()
0...N
Alberta Alberta
Ciin
alpha_kill= Destroyer ("".join(chr(i) for i in range (65, 91)), **)
print (john, alberta).
Output:
John Alberta
Destroyed: 'o' from Jihn's name.
Jahn Alberta
Jihn Alberta
Destroyed: 'h', 'j', 'n' from #'s name.
# Alberta
0.N
Destroyed: 'i' from C##n's name.
Hello, I am C# #n
Hello, I am Alberta
Person
+ name: str
_init(): None
_str(): str
+ push_name(): None
+ pull_name(): None
+ show_name(): None
+ attack(): None
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY