Application Kata "Budget book"

 

Create a program to maintain a budget book. The program is operated via the command line. A payment is made with the following command:

C:>hb payout 5.99 Restaurant visits Chocolate mug

Cash on hand: EUR 50.45
Restaurant visits: EUR 25.99

The first parameter defines whether it is a Payout or Deposit is involved. In the event of a payout, the Amountwhich Category and optionally a Memo text (here "chocolate cup") is specified. The payout can also be given a different date:

C:>hb payment 01.01.2015 700 Rent

Cash on hand: EUR 678.45
Rent: EUR 700.00

At the beginning, when the program is called up for the first time, the cash balance is of course zero. A deposit can be made with the following command:

C:>hb deposit 400

Cash on hand: EUR 450.43

The specified amount is posted to the cash register with the current date. The current cash balance is then displayed. A different date can also be specified here as an option:

C:>hb deposit 01.01.2015 400

Cash on hand: EUR 450.43

To obtain an overview of all deposits and withdrawals for the current month, call up the program using the "overview" command:

C:>hb overview

March 2015
------------------------
Cash on hand: EUR 34.20
Rent: EUR 600
Living expenses: EUR 343.90
Restaurant visits: EUR 76.70
Clothes: 54,60 EUR

To display the overview for a different month, two additional parameters can optionally be specified, namely month and year:

C:>hb overview 12 2014

December 2014
------------------------
Cash on hand: EUR 125.70
Rent: EUR 600
Living expenses: EUR 421.67
Restaurant visits: EUR 120.67
Clothes: 78,90 EUR

Variations

The categories are created automatically the first time they are used. This leads to categories being created inadvertently in the event of typing errors. For this reason, a query should be asked the first time a category is used:

C:>hb disbursement 7 "Books, music"

Should the category "Books, music" be created? (y/n):

If you enter "j", the category is created and the booking is made. If you enter "n", the booking process is canceled.

en_USEnglish