Tax program issue (not sure what to do :L

Hello! This is my first time posting as I'm pretty stubborn when it comes to getting help with anything, so I'm gonna give this a shot. I have this assignment that is a menu driven program where the user is asked to input their full name, address, and filing status. There are two other options to input their income and expenses, and a final option where they can generate different reports. So far the program has been pretty simple to create and haven't had any issues up until it came to figuring out the taxable income and the tax they owed (I assume that is what my professor is asking for. Here is the assignment given, followed by the code I have written thus far:

Assignment #6
15 Points

Create a menu driven program which –

Ask the user for their name
Personal information
Address
Filling status
Income
Expenses
Calculate the tax based on the Tax table (2011)
Allow the user to print different reports -
Income,
Expense,
Tax amount with personal Information
Allow the user to quit
Allow the user to modify their data –
Income
Expense
Menu –

Input User Data
Input Expense
Input Income
Generate Report
Completed Tax form
Income Only
Expense Only
Personal Information
Quit
Use separate functions for:
Input/Output -
Personal information
Income
Exexpense
Tax
Separate function for each type of output
Pass parameters by value and reference

/*
Author: Jeremy
Date: June 21st, 2015
Assignment: 6
Filename: Assignment_6.cpp
This program is a menu driven "tax assistant" that accepts user input to progress. By inputting numbers, the user
progresses through the program, inputting their personal information, their income, and their expenses. One option
allows the user to generate reports on their info, income, expenses, and their taxes.
*/

#include <iostream>
#include <string>
using namespace std;

// Function that displays the user's personal information (Name, address, and filing status)
void personalInfo(string userName, string userAddress, int filingStatus)
{
cout << "\nYour Full name: " << userName << endl;
cout << "\nYour Address: " << userAddress << endl;
cout << "\nYour filing Status: ";
if (filingStatus = 1)
cout << "Single\n\n";
else if (filingStatus = 2)
cout << "Married (Joint)\n\n";
else if (filingStatus = 3)
cout << "Married (Seperate)\n\n";
else if (filingStatus = 4)
cout << "Head of Household\n\n";
return;
}

// Function that displays the user's total income
void incomeForm(float userIncome)
{
cout << "Your total Income: " << fixed;
cout.precision(2);
cout << "$" << userIncome << endl;
return;
}

// Function that displays the user's total expenses
void expenseForm(float userExpense)
{
cout << "Your total Expense: " << fixed;
cout.precision(2);
cout << "$" << userExpense << endl;
return;
}

void taxForm(string userName, string userAddress, int filingStatus)
{
cout << "\nYour Full name: " << userName << endl;
cout << "\nYour Address: " << userAddress << endl;
cout << "\nYour filing Status: ";
if (filingStatus = 1)
cout << "Single\n\n";
else if (filingStatus = 2)
cout << "Married (Joint)\n\n";
else if (filingStatus = 3)
cout << "Married (Seperate)\n\n";
else if (filingStatus = 4)
cout << "Head of Household\n\n";
return;
return;
}

// Function that when called displays the main menu for the program
void showMenu()
{
// Title Screen
cout << "\t\t~~~~+- Tax Form Assistant -+~~~~\n\n";

cout << "\tInput one of the numbers to begin your tax form!\n\n";
cout << "1. User Data\n";
cout << "2. Income\n";
cout << "3. Expense\n";
cout << "4. Generate Reports\n";
cout << "Exit: to exit\n\n";
}

// Secondary menu that when called via user selection dispalsys options to generate different reports
void reportMenu()
{
// Generate Report Menu
cout << "\n\t\t~~~~+- Generate Report Menu -+~~~~\n\n";

cout << "\tInput one of the numbers to generate that report.\n\n";
cout << "1. Income\n";
cout << "2. Expense\n";
cout << "3. Tax with Personal Information\n";
cout << "4. Personal Information\n";
cout << "Return: to return\n\n";
}

// Main function that calls all other functions
int main()
{
// String variable to accept user selection in menu
string menuSelection;

// Controls the While-loop for the whole program
int reBoot = 1;
int genBoot = 1;

// Variables containing Personal Information
char userName[50] = "NO INPUT";
char userAddress[75] = "NO INPUT";
int filingStatus = 1;

// Variables containing Income
float userIncome = 1000;

// Variables containing Expenses
float userExpense = 200;

//While statement that controls the whole program and whether it continues or terminates
while (reBoot = 1)
{
// Main Menu: User can input a number or type exit to progress through the program
showMenu();
// Resets these two values to ensure the code properly executes
menuSelection = "0";

//Accepts user input
cin >> menuSelection;

// User Data
if (menuSelection == "1")
{
// Using cin.getline, the program asks the user to input their full name
cout << "\nWhat is your full name?: ";
cin.ignore();
cin.getline(userName, 50);

// Using cin.getline, the program asks the user to input their address
cout << "\nWhat is your address?: ";
cin.getline(userAddress, 75);

// A new menu appears where the user must input a number to declare their filing status
cout << "\nWhat is your filing status?\n";
cout << "1. Single\n";
cout << "2. Married (joint)\n";
cout << "3. Married (seperate)\n";
cout << "4. Head of household\n";
cout << "ALL OTHER NUMBERS WILL DEFAULT TO SINGLE\n\n";
cin >> filingStatus;
// Checks the number input by the user, if its less than 1 or greater than 4 it defaults to 1
if (filingStatus < 1 || filingStatus > 4)
filingStatus = 1;
}
// Income
else if (menuSelection == "2")
{
// Asks user to input their income for the year
cout << "\n\nWhat is your total income for the year?: ";
cin >> userIncome;
}
// Expenses
else if (menuSelection == "3")
{
// Asks user to input their expenses for the year
cout << "\n\nWhat is your total expenses for the year?: ";
cin >> userExpense;
}
// Generate Reports
else if (menuSelection == "4")
{
while (genBoot = 1)
{
// Calls reportMenu() function to display the menu. Allows user to generate reports
reportMenu();
menuSelection = "0";
cin >> menuSelection;
// Income Only
if (menuSelection == "1")
{
// Generates income report
cout << "\n\t\t~~~~+- Income Report -+~~~~\n\n";
incomeForm(userIncome);
}
// Expenses Only
else if (menuSelection == "2")
{
// Generates expenses report
cout << "\n\t\t~~~~+- Expense Report -+~~~~\n\n";
expenseForm(userExpense);
}
// Tax w/ Personal Information
else if (menuSelection == "3")
{
// Generates tax w/ personal information report
cout << "\n\t\t~~~~+- Tax Report with Personal Info -+~~~~\n\n";
taxForm(userName, userAddress, filingStatus);
}
// Personal Information
else if (menuSelection == "4")
{
// Generates personal information report
cout << "\n\t\t~~~~+- Personal Information -+~~~~\n\n";
personalInfo(userName, userAddress, filingStatus);
}
// Returns to the first menu
else if (menuSelection == "return" || menuSelection == "Return")
{
menuSelection == "1";
genBoot = 0;
break;
}
// Ends the program
else if (menuSelection == "exit" || menuSelection == "Exit")
{
cout << "\nThank you for using this program!\n\n";
return 0;
}
// Checks for valid response
else if (menuSelection < "1" || menuSelection > "4")
{
if (menuSelection != "exit" || menuSelection != "Exit")
{
cout << "\n\nERROR: Invalid input! Please try again.\n\n";
}
}
}
}
// Exits the program
else if (menuSelection == "exit" || menuSelection == "Exit")
{
cout << "\nThank you for using this program!\n\n";
return 0;
}
// Checks for valid response
else if (menuSelection < "1" || menuSelection > "4")
{
if (menuSelection != "exit" || menuSelection != "Exit")
{
cout << "\n\nERROR: Invalid input! Please try again.\n\n";
}
}
}
}

I'm not sure how to begin calculating how much people owe the government based on their filing status and their income. I know I haven't "attempted" the calculation, but I litterally have no idea as what to do :L Any and all help is appreciated
Quick google search

https://www.google.com/search?q=relative+taxable+income+method&ie=utf-8&oe=utf-8#q=taxable+income+formula+2015


+=================================================+
| Table 1. 2015 Taxable Income Brackets and Rates                                 |
+=================================================+
+=======+===============+======================+==========================+
| Rate  | Single Filers | Married Joint Filers | Head of Household Filers |
+=======+===============+======================+==========================+
| 10%   |               |                      |                          |
+-------+---------------+----------------------+--------------------------+
| 15%   |               |                      |                          |
+-------+---------------+----------------------+--------------------------+
| 25%   |               |                      |                          |
+-------+---------------+----------------------+--------------------------+
| 28%   |               |                      |                          |
+-------+---------------+----------------------+--------------------------+
| 33%   |               |                      |                          |
+-------+---------------+----------------------+--------------------------+
| 35%   |               |                      |                          |
+-------+---------------+----------------------+--------------------------+
| 39.6% |               |                      |                          |
+=======+===============+======================+==========================+



I will let you fill in the details from the listed website :)

So then it seems to me one way to write the method is all in one signature and just keep track of what int means what

filerType = 1 = single
filerType = 2 = joint
ect..

double taxOwed(int filerType, double income);

How ever you could use an enum (my preference) rather than a int to manage things.

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
#include <iostream>

using namespace std;

enum FilerType {SINGLE, JOINT, HEADOFHOUSE};
void passEnum(FilerType aFilerType)
{
    switch (aFilerType)
    {
    case SINGLE:
        // do calcs for signal;
        cout << "You passed in SINGLE" << endl;
        break;
    case JOINT:
        // do calcs for JOINT;
        cout << "You passed in JOINT" << endl;
        break;
    case HEADOFHOUSE:
        // do calcs for HEADOFHOUSE;
        cout << "You passed in HEADOFHOUSE" << endl;
        break;
    default:
        cout << "I do not understand what you passed in" << endl;
    }



}
int main()
{
    FilerType myType = SINGLE;
    passEnum(myType);
    myType = JOINT;
    passEnum(myType);
    myType = HEADOFHOUSE;
    passEnum(myType);
    return 0;
}



You passed in SINGLE
You passed in JOINT
You passed in HEADOFHOUSE


I hope that helps. Feel free to ask questions.
Last edited on
Topic archived. No new replies allowed.