Another function question

I am doing a monthly budget project for my introductory C++ course. I am stuck on figuring out how to get the computeTithing() function to send the BudgetTithing back to the getdisplay() function. I'm not sure if I'm supposed to make the call from main() or from getDisplay() or if it matters. I've tried it many different ways with many different results and am just at a loss for what to do.

So my computeTithing() function is supposed to take the income and multiply it by 0.10 and then take that number back to the getDisplay() function and insert it into the display where it says BudgetTithing. Right now it doesn't seem to be returning anything. Does anyone have any hints on what I'm doing wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#include <iostream>
#include <iomanip>
using namespace std;


float getIncome()
{
   float Income;

   cout << "\tYour monthly income: ";
   cin >> Income;

   return Income;
}


float getBudgetLiving()
{
   float BudgetLiving;

   cout << "\tYour budgeted living expenses: ";
   cin >> BudgetLiving;

   return BudgetLiving;
}


float getActualLiving()
{
   float ActualLiving;

   cout << "\tYour actual living expenses: ";
   cin >> ActualLiving;

   return ActualLiving;
}



float getActualOther()
{
   float ActualOther;

   cout << "\tYour actual other expenses: ";
   cin >> ActualOther;

   return ActualOther;
}


float getActualTithing()
{
   float ActualTithing;

   cout << "\tYour actual tithe offerings: ";
   cin >> ActualTithing;

   return ActualTithing;
}


float getActualTax()
{
   float Taxes;

   cout << "\tYour actual taxes withheld: ";
   cin >> Taxes;

   return Taxes;
}


float computeTithing()
{
   float Income;
   float BudgetTithing;

   Income * 0.10 == BudgetTithing;


   return BudgetTithing;
}


void getDisplay(float Income, float BudgetLiving, float ActualLiving, float Taxes, float ActualTithing, float ActualOther)
{

   float BudgetTithing = computeTithing();

   //Set it to show the decimal points

   cout.setf(ios::fixed);
   cout.setf(ios::showpoint);
   cout.precision(2);

   //Display the inputs on a chart
   cout << endl;
   cout << "The following is a report on your monthly expenses\n";
   cout << "\tItem                  Budget          Actual\n";
   cout << "\t=============== =============== ===============\n";
   cout << "\tIncome          $" << setw(11) << Income << "    $"
   << setw(11) << Income << endl;
   
   cout << "\tTaxes           $" << setw(11) << 0.00 << "    $"
   << setw(11) << Taxes << endl;

   cout << "\tTithing         $" << setw(11) << BudgetTithing << "    $"
   << setw(11) << ActualTithing << endl;

   cout << "\tLiving          $" << setw(11) << BudgetLiving << "    $"
   << setw(11) << ActualLiving << endl;

   cout << "\tOther           $" << setw(11) << 0.00 << "    $"
   << setw(11) << ActualOther << endl;

   cout << "\t=============== =============== ===============\n";
   cout << "\tDifference      $" << setw(11) << 0.00 << "    $"
   << setw(11) << 0.00 << endl;


}


}

int main()
{


   //Explain what the program is doing and ask for inputs
   cout << "This program keeps track of your monthly budget\n";
   cout << "Please enter the following:\n";

   float Income = getIncome();

   float BudgetLiving = getBudgetLiving();

   float ActualLiving = getActualLiving();

   float Taxes = getActualTax();

   float ActualTithing = getActualTithing();

   float ActualOther = getActualOther();


   getDisplay(Income, BudgetLiving, ActualLiving, Taxes, ActualTithing, ActualOther);


   return 0;
}

Last edited on
Interesting code
Income * 0.10 == BudgetTithing;

try this on line 81
BudgetTithing= Income * 0.10;
Thank you so much! It didn't completely fix it, but it was an error that I didn't see and helped me to figure out the rest
Topic archived. No new replies allowed.