Inspiration
What it does
How I built it
Challenges I ran into
Accomplishments that I'm proud of
What I learned
What's next for College Budget App
//Otter Hackathon
include
include
include
include "Header.h"
using namespace std; class data { public: float starting_amount = NULL; float amount_owed; void starting_amounts() { if (starting_amount == NULL) { cin >> starting_amount; } else { return; } } void amount_needed(float total_cost, float current_amount) { amount_owed = total_cost - current_amount; } void budget(int time) { budgeting = amount_owed / time; } void set_balence(float added_amount) { balence = starting_amount + added_amount; cout << "your new balence is " << balence << endl; } void withdrawl(float subtracted_amount) { balence = starting_amount - subtracted_amount; cout << "your new balence is" << balence << endl; } void deposit(int choice,int munney) { int budgeting; int balence;
if(choice == 3 )
{
set_balence(munney);
}
if(choice ==2 )
{
amount_needed(0, balence);
}
if (choice == 7)
{
withdrawl(munney);
}
}
private:
float balence;
float budgeting;
}; template class user:public data { public: vector finding_pin; T username_inputed; T password_inputed; bool using_data = false; int pin_inputed; bool pin_found = false;
void find_user()
{
cin >> pin_inputed;
for (int ii = 0; ii < finding_pin.size(); ii++)
{
if (pin_inputed == pin)
{
pin_found = true;
}
}
}
void set_username(T new_username)
{
username = username_inputed = new_username;
}
void set_password(T new_password)
{
password = password_inputed = new_password;
}
void login(T username, T password)
{
username_inputed = username;
password_inputed = password;
}
bool get_data()
{
if (password_inputed == password && username_inputed == username)
{
using_data = true;
}
return using_data;
}
private:
T username;
T password;
int pin;
}; bool button() { user name; int a; float amount_needed; int time; float added_amount; float total_cost = 0; float current_amount = 0; float subtracted_amount; cout << "Please select one of the 4 options" << endl; cout << "1. starting amount" << endl; cout << "2. amount needed" << endl; cout << "3. time" << endl; cout << "4. added amount" << endl; cout << "5. withdrawl amount" << endl; cin >> a; switch (a) {
default:
break;
case 1:
name.starting_amounts();
button();
case 2:
cin >> amount_needed;
name.amount_needed(total_cost, current_amount);
button();
case 3:
cin >> time;
name.budget(time);
button();
case 4:
cin >> added_amount;
name.set_balence(added_amount);
button();
case 5:
cin >> subtracted_amount;
subtracted_amount = subtracted_amount * -1;
name.set_balence(subtracted_amount);
button();
case 6:
return false;
}
} class budget_keeper:public data { public: vector tracker;
}; void main() { user name; string username; string password; int counter = 0; int a; cout << "Set username: " << endl; getline(cin, username); name.set_username(username);
cout << "Set password: " << endl;
getline(cin, password);
name.set_password(password);
cout << "please enter your username and password" << endl;
getline(cin, username);
cout << endl;
getline(cin, password);
name.login(username, password);
while (name.get_data() == false)
{
if (counter < 8)
{
cout << "invalid password. try again." << endl;
cout << "please enter your username and password" << endl;
getline(cin, username);
cout << endl;
getline(cin, password);
name.login(username, password);
}
else
{
cout << "You are out of tries please try again later" << endl;
system("pause");
return;
}
counter++;
}
if (name.get_data() == true)
{
if (button() == false)
{
return;
}
}
}
Log in or sign up for Devpost to join the conversation.