- #1
HoojaMan33
- 15
- 0
Homework Statement
I have an assignment with the following requirements for the functions:
- Tax_Bracket_Identification. This function will identify the tax bracket. This function:
- is of type int;
- has one call-by-value argument (income);
- uses nested if-else statements.
- Tax_Calculation. Will calculate the tax for each income scanned and:
- is of type void;
- has three arguments:
- the income (call-by-value);
- the tax bracket (call-by-value);
- the tax (call-by-reference);
- uses a switch case statement to calculate the income tax.
- PrintAll. This function will print the tax bracket and income tax. It:
- is of type void;
- has two arguments:
- the tax bracket (call-by-value);
- the income tax (call-by-value).
Homework Equations
The Attempt at a Solution
Code:
#include <stdio.h>
int taxBracketIdentification(int);
void taxCalculation(int income, int taxbracket, int *tax);
void printAll(int taxbracket, int tax);
int taxbracket;
void main() {
int incomenumber, tax, income;
printf("Please type in the number of incomes to be processed. \n");
scanf("%d", &incomenumber);
printf("Please type in the income \n");
scanf("%d", &income);
printAll(tax, taxbracket);
}
int taxBracketIdentification(int income) {
int taxbracket;
if (income < 10000) {
taxbracket = 1;
}
else if (income < 20000)
{
taxbracket = 2;
}
else if (income <30000)
{
taxbracket = 3;
}
else if (income < 50000)
{
taxbracket = 4;
}
else if (income < 100000)
{
taxbracket = 5;
}
else if (income > 100000)
{
taxbracket = 6;
}
}
void taxCalculation(int income, int taxbracket, int *tax) {
(taxBracketIdentification(income));
switch(taxbracket) {
case 1:
*tax = (0.05 * income);
break;
case 2:
*tax = 500 + 0.10*(income - 10000);
break;
case 3:
*tax = 1500 + 0.15*(income-20000);
break;
case 4:
*tax = 3000 + 0.20*(income-30000);
break;
case 5:
*tax = 7000 + 0.25*(income-50000);
break;
case 6:
*tax = 19500 + 0.30*(income-10000);
break;
}
void printAll(int taxbracket, int tax)
{
printf("Your tax bracket is: \t %d \n", taxbracket);
printf("Your tax is \t %d \n", tax);}
}
Why is it telling me that there is an undefined reference to printAll?