Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fa4482a
Updated Wage.java
jcreate93 Jun 21, 2021
70dca60
testing remote repos adding commmit
Jun 23, 2021
6b4f2ab
added private variables and established setters and print method for
jcreate93 Jun 27, 2021
6b4df37
added yearlyFrequency setter
jcreate93 Jun 27, 2021
9df82b7
Created ExpenseCalculator Class
jcreate93 Jun 28, 2021
51203c5
added notes on function of classes
jcreate93 Jun 28, 2021
84f2321
Merge branch 'master' of
jcreate93 Jun 28, 2021
cfb8b34
removed <<<head and ==== from ExpenseCalculator.java
jcreate93 Jun 28, 2021
4e7ec49
got rid of teacher notes in Expenser.java
jcreate93 Jun 28, 2021
b69fcc5
testing
Dumpy250 Jun 28, 2021
df2f729
Merge branch 'master' of https://github.com/jcreate93/Ewallet-SENG210
Dumpy250 Jun 28, 2021
ac31f96
Adding a currency method
Dumpy250 Jun 28, 2021
7c33cd0
added setters and getters as well as checks for correct input
jcreate93 Jun 30, 2021
2175a07
Created a currency class
Dumpy250 Jun 30, 2021
2795d03
added monthlysavings constructors under user class
Jul 1, 2021
605e85e
Merge remote-tracking branch 'origin/EWalletAppMainMenu'
jcreate93 Jul 1, 2021
adc8c07
Solid starting poiint after meeting with Professor
Dumpy250 Jul 1, 2021
1766f0f
Merge branch 'issue9AddMonthlyIncome'
jcreate93 Jul 1, 2021
78b544c
updated Expense.java
jcreate93 Jul 1, 2021
7077276
resolving conflicts on Julie's local
jcreate93 Jul 1, 2021
5884d66
Created MyFrame.java
jcreate93 Jul 4, 2021
5c3e777
added main screen GUI to MyFrame.java
jcreate93 Jul 4, 2021
9229b86
updated files
jcreate93 Jul 7, 2021
e8698d6
Added functionality to convert balance to foreign Currency
Dumpy250 Jul 7, 2021
82cecda
Added getters, setters, and constructers to Wage.java
Dumpy250 Jul 9, 2021
92b99d6
Added updateSavings based on incoming wage and outgoing expenses and
joecastroiv Jul 12, 2021
7dafe87
Create LoginFrame.java
jcreate93 Jul 13, 2021
59b391f
Create Validator.java
jcreate93 Jul 13, 2021
fc84ec1
Delete Validator.java
jcreate93 Jul 13, 2021
a76bf67
Create MenuFrame.java
jcreate93 Jul 13, 2021
6ffba2e
Added FileInputStream to LoginFrame, initialized Jframe in MenuFrame,
jcreate93 Jul 13, 2021
10ee06e
modified login file reading, login code sequence
Jul 13, 2021
36330df
update EWalletApp, LoginFrame, MenuFrame
jcreate93 Jul 14, 2021
5a7b147
fix merge conflicts
jcreate93 Jul 14, 2021
0109ac4
Delete MyFrame.java
jcreate93 Jul 14, 2021
4c9aa2c
fix merge conflicts
jcreate93 Jul 14, 2021
6fc7a80
latest version
jcreate93 Jul 21, 2021
404956d
update Frame files
jcreate93 Jul 21, 2021
dbbf7f6
Update MenuFrame.java
jcreate93 Jul 21, 2021
9cca7b7
menuFrame loads crctly-added rfrnce to brain in allforms,fixed addIcnome
Jul 21, 2021
d5b2f0b
Fixed addExpense Added reports.
Dumpy250 Jul 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>210Project-2021</name>
<name>210Project-2021-Julie</name>
<comment></comment>
<projects>
</projects>
Expand Down
6 changes: 6 additions & 0 deletions checkLogin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
User1111
Password1111
User2222
Password2222
User3333
Password3333
18 changes: 16 additions & 2 deletions src/Currency.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@

public class Currency {
public double rate;
public String name;
private double rate = 0;
private String name = "";

public String getCurrency() {
return "Rate: " + this.rate + ", Name: " + this.name;
}
public double getRate() {
return this.rate;
}
public String getName() {
return this.name;
}

public Currency(double rate, String name) {
this.rate = rate;
this.name = name;
}
}
65 changes: 63 additions & 2 deletions src/EWalletApp.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,69 @@
/**This class is used for all GUI components, the login, and the main screen(list of options user can choose from).
* @author SENG 210 - Joseph Castro, Julie Chambers, Cameron Basham
*/
import java.util.Scanner;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JTextField;



/*Teacher notes:
* this is the app class, has the GUI and create one object of your expense
* calculator class. The expense calculator class is the implementation of the Expenser interface
*/

public class EWalletApp {
//this is the app class, has the GUI and create one object of your expense calculator class. The expense calculator class is the implementation of the Expenser interface
private ArrayList<User> AllData;

private static ArrayList<User> AllData = new ArrayList<User>();

public void CreateUser(String username, String password) {}
public static User u = new User();
public static ExpenseCalculator brain = new ExpenseCalculator(u);



public static void main(String[] args) {
System.out.println("Login");
LoginFrame lFrame = new LoginFrame(brain);

/*String name = "";
Scanner scnr = new Scanner(System.in);
name = scnr.next();

for (User u : AllData) {
if (u.username.equals(name)) {
brain.userAtHand = u;
}
}

if (brain.userAtHand == null) {
User u1 = new User();
u1.username = name;
AllData.add(u1);
brain.userAtHand = u1;

}
//add eve3nt handler
Expense e1 = new Expense();

System.out.println("enter the source");
//e1.source = scnr.next();

System.out.println("enter amount");
//e1.amount = scnr.nextDouble();

System.out.println("yearly frequency");
//e1.yearlyFrequency = scnr.nextInt();

//adding expense
brain.addExpense(e1);
brain.userAtHand.printExpenses();

//adding monthly income
//brain.addMonthlyIncome(null);
}
*/

}
}
120 changes: 116 additions & 4 deletions src/Expense.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,119 @@
/**This class allows a user to enter an expense, its source, and designate how often the cost occurs(options include monthly,biweekly or yearly)
*
* @author SENG 210 - Joseph Castro, Julie Chambers, Cameron Basham
*
*/
import java.util.Scanner;

public class Expense {
String source;
double amount;
int yearlyfrequency; //1 for 1 time or once a year, 12 for monthly or or 24 for biweekly
String source;
double amount;
int yearlyFrequency; //1 for 1 time or once a year, 12 for monthly or or 24 for biweekly

boolean foundDigit = false;
boolean foundUpperCase = false;
boolean foundLowerCase = false;
boolean foundSymbol = false;
boolean foundLength = false;
public boolean foundMonthly = false;
public boolean foundYearly = false;
public boolean foundBiweekly = false;



//should add contructor(s)
}

//setters
public void setAmount(double amount){
/*README for (int i = 0; i <= amount; ++i) {
if (amount.isDigit()) {
foundDigit = true;

}
}*/
this.amount = amount;
}
public void setSource(String source) {
for (int i = 0; i < source.length(); ++i) {

//checks if lowercase letters are present
if (source.charAt(i) >= 'a' && source.charAt(i) <= 'z') {
foundLowerCase = true;
}

//checks if uppercase letters present
else if (source.charAt(i) >= 'A' && source.charAt(i) <= 'Z') {
foundUpperCase = true;
}

//checks if there are any digits present
else if (Character.isDigit(source.charAt(i))) {
foundDigit = true;
}

//verifies that the input is letters only
else if (foundLowerCase || foundUpperCase || foundDigit) {
this.source = source;
}

else {
System.out.println("Source can only contain numbers, uppercase letters, or lowercase letters");
}
}







}
public void setYearlyFrequency(int yearlyFrequency) {

//checking for monthly
if (yearlyFrequency == 12) {
foundMonthly = true;
}

//checking for yearly
else if (yearlyFrequency == 1) {
foundYearly = true;
}

//checking for biweekly
else if (yearlyFrequency == 24) {
foundBiweekly = true;
}

//checking to make sure only 1, 12, or 24 is entered
else if (foundMonthly || foundYearly || foundBiweekly) {
this.yearlyFrequency = yearlyFrequency;
}
else {
System.out.println("You can only enter the numbers 1, 12, or 24 for your expense occurance.");
}

}

//getters
public double getAmount() {
return amount;
}
public String getSource() {
return source;
}
public int getYearlyFrequency() {
return yearlyFrequency;
}



public void printExpense() {
System.out.println(amount +"--"+ source + "--" + yearlyFrequency);
}

public String toString() {
return "Source: " + source + "Amount: " + amount + "Yearly Frequency: " + yearlyFrequency;
}

}
142 changes: 142 additions & 0 deletions src/ExpenseCalculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@

/**
* This class is used to implement the Expenser interface
* @author SENG 210 - Joseph Castro, Julie Chambers, Cameron Basham
*
*/


public class ExpenseCalculator implements Expenser{


public ExpenseCalculator (User u) {
userAtHand = u;

}


public User userAtHand;



@Override
public void addExpense(Expense Ex) {
userAtHand.Spending.add(Ex);

}

@Override
public void addMonthlyIncome(Wage W) {
userAtHand.Income.add(W);
// TODO Auto-generated method stub

}

@Override
public void PrintFullreport() {

PrintExpensereport();
PrintIncomereport();


// TODO Auto-generated method stub

}

@Override
public void PrintExpensereport() {
System.out.println(userAtHand.Spending);
// TODO Auto-generated method stub

}

@Override
public void PrintIncomereport() {
System.out.println(userAtHand.Income);
// TODO Auto-generated method stub

}

@Override
public void PrintIncomereportbyTpe() {
// TODO Auto-generated method stub

}

@Override
public void PrintExpensebyType() {
// TODO Auto-generated method stub

}

@Override
public void exportReport(String reportTitle) {
// TODO Auto-generated method stub

}

@Override
public double convertForeignCurrency(String Currency_Name, double amount) {
for (Currency c : userAtHand.currencyRates) {
if (c.getName().equals(Currency_Name)) {
return amount * c.getRate();
}
}

// TODO Auto-generated method stub
return -1;
// return a error message exception
}

public double convertForeignCurrency(String Currency_Name) {
return convertForeignCurrency (Currency_Name, userAtHand.balance);
//return null;
}

@Override
public boolean loadExpenseFile(String filePath) {
// TODO Auto-generated method stub
return false;
}

@Override
public boolean loadIncomeFile(String filePath) {
// TODO Auto-generated method stub
return false;
}

@Override
public int whenCanIBuy(String itemname, double price) {
updateMonthlySavings();
int numberOfMonths = (int) (price / userAtHand.getSavings());;
return numberOfMonths;
}

@Override
public void updateMonthlySavings() {
double totalMonthlyExpenses = 0;
for(Expense i : userAtHand.Spending) {
if (i.foundMonthly) {
totalMonthlyExpenses += i.getAmount();
}
if (i.foundBiweekly) {
totalMonthlyExpenses += i.getAmount() * 2;
}
}
double totalMonthlyIncome = 0;
double totalIncome = 0;

for(Wage i : userAtHand.Income) {
totalIncome += i.amount;
}
totalMonthlyIncome = totalIncome / 12;

double finalSavings = totalMonthlyIncome - totalMonthlyExpenses;
userAtHand.setSavings(finalSavings);

}

}



Loading