Open DanielIkhwan21 opened 3 days ago
class Taxpayer: def init(self, taxpayer_id, name, income): self.taxpayer_id = taxpayer_id self.name = name self.income = income
class TaxRegistration: def init(self): self.taxpayers = {}
def register_taxpayer(self, taxpayer_id, name, income):
if taxpayer_id in self.taxpayers:
raise ValueError("Taxpayer ID already registered.")
taxpayer = Taxpayer(taxpayer_id, name, income)
self.taxpayers[taxpayer_id] = taxpayer
print(f"Taxpayer {name} registered successfully.")
return taxpayer
def get_taxpayer(self, taxpayer_id):
if taxpayer_id not in self.taxpayers:
raise ValueError("Taxpayer ID not found.")
return self.taxpayers[taxpayer_id]
if name == "main": registration = TaxRegistration()
# Registering taxpayers
registration.register_taxpayer("12345", "John Doe", 50000)
registration.register_taxpayer("67890", "Jane Smith", 75000)
# Retrieving taxpayer information
taxpayer = registration.get_taxpayer("12345")
print(f"Retrieved taxpayer: {taxpayer.name}, Income: ${taxpayer.income}")
the code does not work
Develop a module to allow taxpayers to register online, providing necessary information securely and efficiently.