DanielIkhwan21 / e-governance-tax-system

0 stars 0 forks source link

Taxpayer Registration Module #2

Open DanielIkhwan21 opened 3 days ago

DanielIkhwan21 commented 3 days ago

Develop a module to allow taxpayers to register online, providing necessary information securely and efficiently.

DanielIkhwan21 commented 3 days ago

Simple tax registration module

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]

Example usage

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}")
Nothaikal commented 2 days ago

the code does not work