class FinancialLiteracyClass: def __init__(self, student_name, teacher_name, school_name): self.student_name = student_name self.teacher_name = teacher_name self.school_name = school_name self.modules = [] def add_module(self, module_name, topics): """ Add a module to the class curriculum. :param module_name: Name of the module. :param topics: A list of topics to be covered in the module. """ module = {"module_name": module_name, "topics": topics} self.modules.append(module) def list_modules(self): """ List all modules and their topics in the curriculum. """ for module in self.modules: print(f"Module: {module['module_name']}") print("Topics:") for topic in module['topics']: print(f" - {topic}") print() def teach(self): """ Simulate teaching the class by covering each module's topics. """ print(f"Welcome to the Financial Literacy Class for {self.student_name}!") print(f"Taught by {self.teacher_name} at {self.school_name}\n") for module in self.modules: print(f"Module: {module['module_name']}") print("Topics:") for topic in module['topics']: print(f" - {topic}") print("\n[Teaching the module]") def evaluate(self): """ Evaluate the students' understanding of financial literacy. This can include quizzes, assignments, or tests. """ # Implement evaluation methods here pass # Example Usage: if __name__ == "__main__": finance_class = FinancialLiteracyClass("John Smith", "Mrs. Johnson", "City High School") # Add modules to the curriculum finance_class.add_module("Module 1: Budgeting", ["Creating a budget", "Tracking expenses", "Saving and investing"]) finance_class.add_module("Module 2: Credit and Debt", ["Understanding credit scores", "Managing debt"]) finance_class.add_module("Module 3: Investing", ["Stocks and bonds", "Risk and return"]) # List modules and topics finance_class.list_modules() # Simulate teaching the class finance_class.teach() # Evaluate the students finance_class.evaluate()
class FinancialLiteracyClass:
    def __init__(self, name, age, income, expenses, savings=0, debt=0):
        self.name = name
        self.age = age
        self.income = income
        self.expenses = expenses
        self.savings = savings
        self.debt = debt

    def calculate_savings_rate(self):
        savings_rate = (self.savings / self.income) * 100
        return savings_rate

    def calculate_expense_ratio(self):
        expense_ratio = (self.expenses / self.income) * 100
        return expense_ratio

    def calculate_net_worth(self):
        net_worth = self.savings - self.debt
        return net_worth

    def set_income(self, income):
        self.income = income

    def set_expenses(self, expenses):
        self.expenses = expenses

    def set_savings(self, savings):
        self.savings = savings

    def set_debt(self, debt):
        self.debt = debt

# Example usage of the FinancialLiteracyClass
person = FinancialLiteracyClass("John Doe", 30, 50000, 30000, 20000, 5000)
print(f"Name: {person.name}")
print(f"Savings Rate: {person.calculate_savings_rate()}%")
print(f"Expense Ratio: {person.calculate_expense_ratio()}%")
print(f"Net Worth: ${person.calculate_net_worth()}")