-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbudget.cpp
More file actions
169 lines (130 loc) · 3.96 KB
/
budget.cpp
File metadata and controls
169 lines (130 loc) · 3.96 KB
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
double salary;
double monthSal = salary / 12;
double rent;
double utilities;
double phone;
double enter;
double clothing;
double food;
double car;
double insurance;
double tax;
double monthTax = tax / 12;
double other;
double totalCost = rent + utilities + phone + enter + other + clothing + food + monthTax + insurance + car;
double yearCost = totalCost * 12;
void start(int)
{
int des;
cout << "Create an account or Sign In." << endl;
cout << "Sign in = 1" << endl;
cout << "Sign up = 2" << endl;
cin >> des;
}
void data (double)
{
string user1;
string username;
string password;
ifstream inputFile;
inputFile.open("newdata.txt");
cout << "Enter your username." << endl;
cin >> username;
cout << "Enter your password." << endl;
cin >> password;
for (int count = 1; count <= 1; count++)
{
inputFile >> user1;
}
if (user1 == password){
cout << "Access Granted." << endl;
}else{
cout << "Access Denied." << endl;
exit(0);
}
inputFile.open("newdata.txt");
}
void create (double)
{
string code;
ofstream outputFile;
outputFile.open("newdata.txt");
cout << "Create your code." << endl;
cin >> code;
outputFile << code;
outputFile.close();
cout << "Your account has been created.\n" << endl;
}
void questions(double) {
/* Budget Manager */
cout << "How much do you make in a year?" << endl;
cout << "$";
cin >> salary;
cout << "How much do you pay in rent/mortgage?" << endl;
cout << "$";
cin >> rent;
cout << "How much are your utilities every month?" << endl;
cout << "$";
cin >> utilities;
cout << "How much is your phone bill every month?" << endl;
cout << "$";
cin >> phone;
cout << "How much do you pay for entertainment every month?" << endl;
cout << "$";
cin >> enter;
cout << "How much do you spend on clothing per month?" << endl;
cout << "$";
cin >> clothing;
cout << "How much do you spend of food in a month?" << endl;
cout << "$";
cin >> food;
cout << "How much do you spend on gas?" << endl;
cout << "$";
cin >> car;
cout << "How much do you pay in insurence? (Home, Liability, Car, Life, etc)" << endl;
cout << "$";
cin >> insurance;
cout << "How much do you pay in taxes in a year?" << endl;
cout << "$";
cin >> tax;
cout << "Other monthly expenses that wern't covered above?" << endl;
cout << "$";
cin >> other;
cout << "Your total cost per month is, $" << totalCost << " and your total yearly cost is, $" << yearCost
<< endl << endl;
}
void goalQs () {
double dispose;
cout << "How much disposable income would you like at the end of the month? (Take Home)" << endl;
cout << "$";
cin >> dispose;
double save;
cout << "How much money would you like to put into savings each month." << endl;
cout << "$";
cin >> save;
double realDispose = salary - yearCost;
double monthlyDispose = monthSal - totalCost;
cout << "Your yearly disposable income is $" << realDispose << " and your monthly disposable is $"
<< monthlyDispose << endl;
if (dispose < monthlyDispose) {
cout << "You have passed your monthly disposable goal. Great job!" << endl;
} else if (dispose == monthlyDispose) {
cout << "Your right on the money!" << endl;
} else {
cout << "You will need to cut back on spending or make more per month to make your goal." << endl;
};
}
int main() {
start();
data();
create();
if start() == 2 {
questions();
goalQs();
}else{
}
}