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...
icon
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
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
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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…
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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY