# Combined code for Address, Job, Person, and Main in one file
# Address class
class Address:
def __init__(self, street, city, state, zip_code):
self.street = street # Street address
self.city = city # City name
self.state = state # State name
self.zip_code = zip_code # ZIP code
def __str__(self):
return f"{self.street}, {self.city}, {self.state} - {self.zip_code}"
# Job class
class Job:
def __init__(self, job_title, company, salary):
self.job_title = job_title # Job title
self.company = company # Company name
self.salary = salary # Annual salary
def __str__(self):
return f"{self.job_title} at {self.company}, Salary: ${self.salary}"
# Person class
class Person:
def __init__(self, name, age, address, job):
self.name = name # Name of the person
self.age = age # Age of the person
self.address = address # Address object
self.job = job # Job object
def display_info(self):
print(f"Name: {self.name}")
print(f"Age: {self.age}")
print(f"Address: {self.address}")
print(f"Job: {self.job}")
# Main program to create and display information
if __name__ == "__main__":
# Create an Address object
address1 = Address("123 Main St", "Springfield", "IL", "62704")
# Create a Job object
job1 = Job("Software Developer", "TechCorp", 95000)
# Create a Person object
person1 = Person("John Doe", 30, address1, job1)
# Display information about the person
person1.display_info()
Output
Name: John Doe
Age: 30
Address: 123 Main St, Springfield, IL - 62704
Job: Software Developer at TechCorp, Salary: $95000