Error Code on Monthly Budget | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Error Code on Monthly Budget

This program keeps track of a monthly budget. Now the problem is, I want this test to put in small integer values that should be formatted correctly. But that is not happening... https://code.sololearn.com/cDpaLj5JihBw/# This is the error I get and the lines with "Exp. " is the expected outcome. Starting Test 1 This test will put in small integer values that should be formatted correctly > This program keeps track of your monthly budget > Please enter the following: > Your monthly income: 1 > Your budgeted living expenses: 2 > Your actual living expenses: 3 > Your actual taxes withheld: 4 > Your actual tithe offerings: 5 > Your actual other expenses: 6 > > The following is a report on your monthly expenses > Item Budget Actual > =============== =============== =============== > \tIncome $ 3123.96 $ 3123.96\n Exp: \tIncome $ 1.00 $ 1.00\n > \tTaxes $ 0.00 $ 107.23\n Exp: \tTaxes $ 0.00 $ 4.00\n > \tTithing $ 0.00 $ 120.00\n Exp: \tTithing $ 0.00 $ 5.00\n > \tLiving $ 650.99 $ 745.03\n Exp: \tLiving $ 2.00 $ 3.00\n > \tOther $ 0.00 $ 154.96\n Exp: \tOther $ 0.00 $ 6.00\n > =============== =============== =============== > Difference $ 0.00 $ 0.00 Test 1 failed. Please, your review would be nice.

11th May 2019, 7:08 AM
Joshua Olaoye
Joshua Olaoye - avatar
1 Answer
0
First of all, break up your code and use functions, struct and class to encapsulate data and functionality. Write tests for your functions and classes.
11th May 2019, 7:29 AM
Daniel Adam
Daniel Adam - avatar