Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm not really getting the output I'm looking for. Could someone adjust my code and help explain? Design a class that holds the following personal

I'm not really getting the output I'm looking for. Could someone adjust my code and help explain?

Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods (get and set). Write a program that creates three instances of the class. One instance should hold your information and the other two should hold your friends or family members' information. Just add information, don't get it from the user. Print the data from each object, make sure to format the output for clarity and ease of reading.

class Person: def __init__(self, name, address, age, phone): self._name = name self._address = address self._age = age self._phone = phone def set_name(self, name): self._name = name def set_address(self, address): self._address = address def set_age(self, age): self._age = age def set_phone(self, phone): self._phone = phone def get_name(self): return self._name def get_address(self): return self._address def get_age(self): return self._age def get_phone(self): return self._phone def main(): p1 = Person("Justin", "1 MG Road", 27, "8153073035") p2 = Person("John", "2 Bay Road", 15, "8153093939") p3 = Person("Ben", "3 Sun Road", 15, "8152342345") print("Three instances have been created.") print(p1) print(p2) print(p3) main() 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

Why could the Robert Bosch approach make sense to the company?

Answered: 1 week ago