Skip to content
Elchanan Heller edited this page Nov 3, 2021 · 2 revisions

About

About BudgetC

BudgetC is a budgeting program designed to track a user's monthly budget for one calendar year. Specifically, it tracks expenditures in five user-defined categories, along with income and savings contributions.

BudgetC is interacted with via the use of a graphical menu and numeric entry.

BudgetC reads a user's budget from a plain text file and stores the data in a structure element. A user can record budget entries, such as expenses, income, or savings, written to an array of structures while the program is in use and saved to a text file for persistent storage.

A menu bar provides graphical guidance as the user navigates the program and dynamic confirmation prompts provide advice and context.


BudgetC Reports

The Monthly Report summarizes the month's expenditures, lets the user know how much more they are free to spend in each category while remaining within budget, and alerts the user for any over-budget expenses.

The Yearly Report provides a year-to-date summary across all expense types and for all months of the year. The Yearly Report also lists expense categories sorted from highest to lowest.

Using BudgetC

Setting up a Budget

A budget is entered via the bud.txt file using the following format. The file should begin by listing five expense categories. These categories should consist of single word under 20 characters in length.

  • The sixth category is reserved for income (but should still be listed in bud.txt).
  • The seventh category is reserved for savings (and likewise, should be listed, too).

A sample budget input file is shown below:

Housing
Food
Transport
Bills
Fun
Income
Savings
200
200
200
200
200
2000
100

Running the Program

Budget.C is launched with the following two commands:

$ gcc budget.c myFuncs.c
$ ./a.out bud.txt db.txt

The Main Menu

Using the program is intuitive and straightforward. At the first launch, the user is presented with the Main Menu, appearing below, which provides access to the program's main features..

BudgetC > Main Menu
========================================
Enter 1 ... to record data
Enter 2 ... to print your budget
Enter 3 ... to print a monthly report
Enter 4 ... to print a yearly report
Enter 0 ... to quit BudgetC
========================================
Option: 

Choose a number that corresponds to the desired choice and hit enter to submit your selection. For example, hit 2 and enter to print a Budget Summary.


Printing a Budget Summary

Here is a sample Budget Summary for the budget entered above. The Summary lists the user's categories and the budgeted amounts along with income and savings contributions. The Budget Analysis section summarizes total expenses for the month after accounting for all costs plus any savings contribution. The Alerts section notifies the user if the budget is balanced or not and reports how much cash is left after accounting for all expenses.

Main Menu > Budget Summary
Here is your budget summary:

Category             Amount     
--------------------------------------
Housing              $    200.00
Food                 $    200.00
Transport            $    200.00
Bills                $    200.00
Fun                  $    200.00

Cash
--------------------------------------
Income               $   2000.00
Savings              $    100.00

Budget Analysis:
--------------------------------------
Total expenses:      $   1000.00
After savings:       $   1100.00

Alerts:
--------------------------------------
Congratulations! Your budget is balanced.
Cash remaining after all expenses: $900.00

Recording Data

To record data, hit 1 and enter from the Main Menu. Select a month for the expense from the Select Month Menu, which is seen below:

Main Menu > Select Month Menu
Select a month:
=============================
Enter  1 ... for January   
Enter  2 ... for February  
Enter  3 ... for March     
Enter  4 ... for April     
Enter  5 ... for May       
Enter  6 ... for June      
Enter  7 ... for July      
Enter  8 ... for August    
Enter  9 ... for September 
Enter 10 ... for October   
Enter 11 ... for November  
Enter 12 ... for December  
=============================
Month: 

After choosing a month, the Data Entry Menu appears, allowing you to choose an entry type. Choose an entry type by entering the corresponding value and enter or hit 4 and enter to return to Main Menu.

Main Menu > Data Entry Menu
=============================================
Enter 1 ... to record an expense
Enter 2 ... to record a paycheck
Enter 3 ... to record a savings contribution
Enter 4 ... to return to the main menu
=============================================
Option: 

For example, to record an expense hit 1 and enter to launch the Expense Category Menu seen below:

Data Entry > Expense Category Menu
Choose an expense category
=======================================
Enter 1 ... for Housing             
Enter 2 ... for Food                
Enter 3 ... for Transport           
Enter 4 ... for Bills               
Enter 5 ... for Fun                 
=======================================
Expense category: 

Select an expense category by choosing the corresponding category value. You will then be prompted to enter the expense amount. Enter the amount and hit enter. A confirmation message appears, which includes the updated expense balance and the budgeted amount for that category. The Data Entry Menu then reappears, allowing you to enter another expense or hit 4 and enter to return to the Main Menu. This process is shown below.

  • To record an income entry or savings contribution, follow the above steps while entering 2 or 3, respectively, from the Data Entry Menu.
  • To remove an entry, enter the amount you would like to delete proceeded with a negative sign. For example, to delete a $10 entry, enter -10.00 in the Data Entry Menu.
  • To enter data for another month, hit 4 and enter to return to the Main Menu. Hit 1 and enter to reach the Select a Month Menu again.
Expense category: 1
Housing successfully selected

Enter an amount: $200
Success! An entry for $200.00 has been recorded.
---------------------------------------
Your Housing balance is now: $200.00
You budgeted $200.00 for Housing

Printing a Monthly Summary

To print a Monthly Summary, hit 3 and enter from the Main Menu. Choose a month from the Select Month Menu. A sample Monthly Summary appears below.

  • The Remaining Balance section in Spend Analysis displays how much cash-on-hand remains after accounting for all expenses and any savings contributions for the month.
  • The Alerts section highlights budget overspending if any
Main Menu > Monthly Report
Here is your monthly report for January:

Category             Budgeted        Spent           Remaining  
-------------------------------------------------------------------
Housing              $    200.00     $    200.00     $      0.00
Food                 $    200.00     $    100.00     $    100.00
Transport            $    200.00     $    100.00     $    100.00
Bills                $    200.00     $     50.00     $    150.00
Fun                  $    200.00     $     50.00     $    150.00

Cash                 Budgeted        Current    
-------------------------------------------------------------------
Income               $   2000.00     $   1000.00
Savings              $    100.00     $    100.00

Savings Balance:
-------------------------------------------------------------------
Contributions to date: $100.00

Spend Analysis:
-------------------------------------------------------------------
Monthly expenses:       $    500.00
Savings contributions:  $    100.00
Estimated income:       $   2000.00
Remaining balance:      $   1400.00

Alerts:
-------------------------------------------------------------------
Nice job! Your spending is within budget.

Printing a Yearly Report

The Yearly Report provides an up-to-date accounting of all expenses across all categories and for all months of the year. It summarizes total costs, total income, and total savings to date. Additionally, the Report provides a listing of total expenditures by category sorted from highest to lowest. A sample Yearly Report appears below:

Main Menu > Yearly Report
Here is your yearly report:

Category             Budgeted       Yearly Spend
-------------------------------------------------------
Housing              $   2400.00    $    400.00
Food                 $   2400.00    $    200.00
Transport            $   2400.00    $    200.00
Bills                $   2400.00    $    100.00
Fun                  $   2400.00    $    100.00

Cash                 Estimated      Actual     
-------------------------------------------------------
Income               $  24000.00    $   4000.00
Savings              $   1200.00    $    200.00

Expense totals sorted from highest to lowest:

Category             Yearly Spend
------------------------------------------------------
Housing              $    400.00
Food                 $    200.00
Transport            $    200.00
Bills                $    100.00
Fun                  $    100.00

Closing the Program

To exit the program, hit 0 and enter from the Main Menu. The program will also exit if the user enters any invalid entries. An invalid entry in the Data Entry Menu, however, returns the user to Main Menu.

After each valid user entry, BudgetC saves the data by writing to the db.txt file. This plain text file lists the total values across all categories for an entire year.

The following snippet shows what the file looks like after the program recorded the data shown in the Monthly Summary for January above.

200.000000
100.000000
100.000000
50.000000
50.000000
1000.000000
100.000000