Draft

Mini-project: Fiscal Reports

Description:

In this kata, you're going to do the bookkeeping for a newly started business, doing some debit, some credit, and putting together the fiscal reports at the end of the year. Since the business just started out and you live in a free society, the fiscal reports will be very simple and no tax is beeing payed. All payments are cash payments.

BALANCE SHEET:

ASSETS:
Materials: value
Property: value
Cash: value
TOTAL: value

LIABILITIES:
Equity: value
Loans: value
TOTAL: value

RESULT REPORT:

RESULT:
Revenue: $
Costs: $
Profit: $

INPUT:

cash: an integer representing the amount of cash on the balance sheet at the beginning of the year
materials_left: an integer representing the worth of the raw materials left at the end of the year
loans: a list of objects of Loan-type (see below for info)
property: a list of objects of Property-type (see below for info)
transactions: a list of objects of Transaction-type (see below for info)
class Loan:
    def __init__(self, worth, mortgage, interest):
        self.worth = worth # (int) the amount of money borrowed
        self.mortgage = mortgage # (int) the amount of money payed in mortgage at the end of the year
        self.interest = interest # (float 0 < x < 1) interest payed at the end of the year

class Property:
    def __init__(self, worth, depreciation):
        self.worth = worth # (int) value of property
        self.depreciation = depreciation # (int) the amount the property decreases in value at the end of the year
        
class Transaction:
    def __init__(self, type, worth):
        self.type = type # (str) 'BUY' or 'SELL'. 'BUY' = more raw materials are purchased, 'SELL' = products are sold
        self.worth = worth # value of transaction

OUTPUT:

Given the input, your task is to make all the transactions and return a single string containing the balance sheet and result report at the end of the year. String format:

ASSETS:
Materials: $
Property: $
Cash: $
TOTAL: $

LIABILITIES:
Equity: $
Loans: $
TOTAL: $

RESULT:
Revenue: $
Costs: $
Profit: $

NOTES:

What are costs? Costs = Value of materials in goods sold + depreciation + interest. There are no materials in storage at the beginning of the year.

What is depreciation? Depreciation is the annual decrease in value of property or other non-current assets. Depreciation doesn't affect the cashflow.

Mortgage and interest: Mortgage and interest will be payed in cash at the end of the year. When paying interest, round each amount to nearest integer. So if you have a loan for 101 and the interest is 0.1, you should pay 10 in interest for that loan. Only mortgage will affect the loan balance.

Profit/loss: Revenue - Costs = Profit/Loss. The profit/loss is added to Equity.

Balance sheet: First rule in accounting: Assets = Liabilites. If this isn't true at the end of the year, you've made a mistake. The worth of Equity at the beginning of the year isn't given as input, but is easily derived from the input given.

Transactions: Other than the objects of Transaction-type, mortgage and interest payments are also transactions. In all transactions, cash is either flowing in or out, depending on the nature of the transaction.

Revenue: Goods are delivered instantaneously, meaning sold goods are revenue.

Useful information: https://en.wikipedia.org/wiki/Double-entry_bookkeeping

FEEDBACK:

Even if you're not going to complete this kata, please leave feedback on the description! I've done my best to make this as concise and informative possible. Any suggestions of improvements are most welcome!

Fundamentals

Similar Kata:

More By Author:

Check out these other kata created by slimedog

Stats:

CreatedAug 7, 2021
Warriors Trained21
Total Skips0
Total Code Submissions42
Total Times Completed5
Python Completions5
Total Stars1
% of votes with a positive feedback rating50% of 2
Total "Very Satisfied" Votes1
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes1
Total Rank Assessments2
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • slimedog Avatar
Ad