Monday, July 25, 2016

Simple Budget Calculator in C#



Here's another word problem similar to the calculator with word problem and solution included!

I would like a budget calculator for this month to see how much over or under budget I was last month. The application will prompt me for my total budget for last month when I start the application.

Once I enter my total budget, it will ask me the following:
  • How much did you spend on groceries?
  • How much did you spend eating out?
  • How much did you spend on fuel?
  • How much did you spend on entertainment?
At the end, the application will tell me how much money I either over-spent or under-spent. Make sure it works for both over- and under- spending. For example, the console should look like this:


This is the Program.cs file below.



This is some class file, for ex. BudgetClass.cs below:



Simple Calculator without Order of Operations in C#



I have recently started a new job, and with it I decided to do mentoring for a junior developer program. Because of this, I will be working on puzzles / mini-apps with them and I will be posting my solutions to them here for anyone else to use :). It is easiest for me to guide when I solve the problem beforehand. Below is a C# calculator without order of operations (to keep it simple this is a good starting place). Next will be one with order of operations using the tree method.

This is the Program.cs file below.



This is some class file, for ex. Calculator.cs below: