회계구조

2026년 2월 25일 14:55분

class Amount:
    def __init__(self, talents: int, shekels: int):
        self.talents = talents
        self.shekels = shekels

    def equals_to(self, other) -> bool:
        return other is not None and self.talents == other.talents and self.shekels == other.shekels

    def format(self) -> str:
        return f"{self.talents} talents, {self.shekels} shekels"

class Ledger:
    def __init__(self):
        self.totals = {}

    def put(self, key: str, amount: Amount):
        self.totals[key] = amount

    def get(self, key: str):
        return self.totals.get(key)

def expected_from_text() -> Ledger:
    l = Ledger()
    l.put("금 / Gold", Amount(29, 730))
    l.put("은 / Silver", Amount(100, 1775))
    l.put("놋 / Brass", Amount(70, 2400))
    return l

def counted_report() -> Ledger:
    l = Ledger()
    l.put("금 / Gold", Amount(29, 730))
    l.put("은 / Silver", Amount(100, 1775))
    l.put("놋 / Brass", Amount(70, 2400))
    return l

def reconcile(expected: Ledger, actual: Ledger) -> bool:
    keys = ["금 / Gold", "은 / Silver", "놋 / Brass"]
    for k in keys:
        e = expected.get(k)
        a = actual.get(k)
        if e is None or a is None:
            return False
        if not e.equals_to(a):
            return False
    return True

def print_line(label: str, key: str, amount: Amount):
    print(f"{label} {key} = {amount.format()}")

expected = expected_from_text()
actual = counted_report()

print_line("EXPECTED:", "금 / Gold", expected.get("금 / Gold"))
print_line("EXPECTED:", "은 / Silver", expected.get("은 / Silver"))
print_line("EXPECTED:", "놋 / Brass", expected.get("놋 / Brass"))

print_line("ACTUAL:  ", "금 / Gold", actual.get("금 / Gold"))
print_line("ACTUAL:  ", "은 / Silver", actual.get("은 / Silver"))
print_line("ACTUAL:  ", "놋 / Brass", actual.get("놋 / Brass"))

print("RECONCILE:", "MATCH / 일치" if reconcile(expected, actual) else "MISMATCH / 불일치")

package com.jesusbornd.exodus;

import java.util.HashMap;
import java.util.Map;

public class Exodus_38_Chapter_Lv3 {

    static class Amount {
        int talents;
        int shekels;

        Amount(int talents, int shekels) {
            this.talents = talents;
            this.shekels = shekels;
        }

        boolean equalsTo(Amount other) {
            return other != null && this.talents == other.talents && this.shekels == other.shekels;
        }

        String format() {
            return talents + " talents, " + shekels + " shekels";
        }
    }

    static class Ledger {
        Map<String, Amount> totals = new HashMap<String, Amount>();

        void put(String key, Amount amount) {
            totals.put(key, amount);
        }

        Amount get(String key) {
            return totals.get(key);
        }
    }

    static Ledger expectedFromText() {
        Ledger l = new Ledger();
        l.put("금 / Gold", new Amount(29, 730));
        l.put("은 / Silver", new Amount(100, 1775));
        l.put("놋 / Brass", new Amount(70, 2400));
        return l;
    }

    static Ledger countedReport() {
        Ledger l = new Ledger();
        l.put("금 / Gold", new Amount(29, 730));
        l.put("은 / Silver", new Amount(100, 1775));
        l.put("놋 / Brass", new Amount(70, 2400));
        return l;
    }

    static boolean reconcile(Ledger expected, Ledger actual) {
        String[] keys = new String[] {"금 / Gold", "은 / Silver", "놋 / Brass"};
        for (int i = 0; i < keys.length; i++) {
            String k = keys[i];
            Amount e = expected.get(k);
            Amount a = actual.get(k);
            if (e == null || a == null) return false;
            if (!e.equalsTo(a)) return false;
        }
        return true;
    }

    static void printLine(String label, String key, Amount a) {
        System.out.println(label + " " + key + " = " + a.format());
    }

    public static void main(String[] args) {
        Ledger expected = expectedFromText();
        Ledger actual = countedReport();

        printLine("EXPECTED:", "금 / Gold", expected.get("금 / Gold"));
        printLine("EXPECTED:", "은 / Silver", expected.get("은 / Silver"));
        printLine("EXPECTED:", "놋 / Brass", expected.get("놋 / Brass"));

        printLine("ACTUAL:  ", "금 / Gold", actual.get("금 / Gold"));
        printLine("ACTUAL:  ", "은 / Silver", actual.get("은 / Silver"));
        printLine("ACTUAL:  ", "놋 / Brass", actual.get("놋 / Brass"));

        System.out.println("RECONCILE: " + (reconcile(expected, actual) ? "MATCH / 일치" : "MISMATCH / 불일치"));
    }
}

Comments

Avatar
 2026년 2월 25일 14:57분

신앙도 결국 하나님 앞에서 이렇게 맞춰지는 과정이 아닐까 생각이 듭니다. 내 생각과 삶이 하나님의 기준과 일치해 가는 것, 그것이 믿음의 여정이라는 느낌이네요.



Search

← 목록으로