//calculate taxes for user in a given year --------------------------------- FIX public double getFederalIncomeTax(YearlyTaxProfile ytp) { //based on taxable income (agi) double money = getAdjustedGrossIncome(ytp); double taxes = 0; for (int i = 0; i < incomeTaxList.Count(); i++) { if (money > incomeTaxList[i].taxedAmount) { //add to taxes taxes += incomeTaxList[i].taxedAmount * incomeTaxList[i].taxRate; //subtract what has already been taxed money -= incomeTaxList[i].taxedAmount; } else if (money > 0) { //tax remaining money taxes += money * incomeTaxList[i].taxRate; //subtract remainder money -= money * incomeTaxList[i].taxRate; } } return(taxes); }
public double getFICA_Taxes(YearlyTaxProfile ytp) { //TO DO: FICA taxes aren't fixed - use a database to store different years data double taxrate = 0.07;//FIX HARDCODED //tax on everything except exempt contributions return(taxrate * (ytp.getSalary() - ytp.getPreTaxContributions())); }
//function loads all database info on a user into program void Load_Profile_Query(String connect, String u_id, UserProfile user) { String query = "SELECT * FROM UserData WHERE ID_NUM = @uid"; int col_num = 7;//num columns of profile data //var result = new System.Text.StringBuilder(); OleDbConnection c = new OleDbConnection(connect); OleDbCommand cmd = new OleDbCommand(query, c); c.Open(); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@uid", u_id); OleDbDataReader reader = cmd.ExecuteReader(); //read every row while (reader.Read()) { //create new tax profile YearlyTaxProfile ytp = new YearlyTaxProfile(); //loop all column data for (int i = 0; i < col_num; i++) { //if i = certain col insert data into tax profile switch (i) { case 0: ytp.setUID(Convert.ToDouble(reader[i].ToString())); break; case 1: ytp.setIDnum(Convert.ToDouble(reader[i].ToString())); break; case 2: ytp.setSalary(Convert.ToDouble(reader[i].ToString())); break; case 3: ytp.setFilingStatus(reader[i].ToString()); break; case 4: ytp.setPreTaxContributions(Convert.ToDouble(reader[i].ToString())); break; case 5: ytp.setPostTaxContributions(Convert.ToDouble(reader[i].ToString())); break; case 6: ytp.setYear(Convert.ToDouble(reader[i].ToString())); break; default: break; } } //add tax profile to list in user profile user.userTaxHistory.Add(ytp); } //sort the list by year user.userTaxHistory.Sort((x, y) => x.getYear().CompareTo(y.getYear())); c.Close(); }
public double getAdjustedGrossIncome(YearlyTaxProfile ytp) { return(ytp.getSalary() - ytp.getPreTaxContributions() - this.getTaxDeductions()); }
public double getTakeHomePay(YearlyTaxProfile ytp) { //TO DO: Add federal income taxes //return annualSalary - getFICA_Taxes()- getFederalIncomeTax()-getLocalIncomeTax()-pretaxcontributions return(ytp.getSalary() - this.getFICA_Taxes(ytp) - ytp.getPreTaxContributions()); }