lundi 30 mars 2015

Receiving "Control may reach end of non-void function"

The output should allow the user to enter his/her taxable income then choose a filing status then receive his/her tax due. When I try to run, I receive "control may reach end of non-void function" at the end bracket of each function such as float single's end bracket.



#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

void taxableincome (float *TI)
{
printf("Enter your taxable income ");
scanf("%f", &*TI);
}

float single (float TI)
{
if (TI > 0 && TI <=24000)
return .15 * TI;
if (TI > 24000 && TI <= 58150)
return 3600 + .28 * (TI - 24000);
if (TI > 58150 && TI <= 121300)
return 13162.00 + .31 * (TI - 58150);
if (TI > 121300 && TI <= 263750)
return 32738.50 + .36 * (TI - 121300);
if (TI < 263750)
return 84020.50 + .396 * (TI - 263750);
}

float marriedfilingjointly (float TI)
{
if (TI > 0 && TI <= 40100)
return .15 * TI;
if (TI > 40100 && TI <= 96900)
return 6015 + .28 * (TI - 40100);
if (TI > 96900 && TI <= 147700)
return 21919.00 + .31 * (TI - 96900);
if (TI > 147700 && TI <= 263750)
return 37667.00 + .36 * (TI - 14770);
if (TI > 263750)
return 79445.00 + .396 * (TI - 263750);
}

float marriedfilingseperately (float TI)
{
if (TI > 0 && TI <=20050)
return .15 + TI;
if (TI > 20050 && TI <= 48450)
return 3007.50 + .28 * (TI - 20050);
if (TI > 48450 && TI <= 73850)
return 10959.50 + .31 * (TI - 48450);
if (TI > 73850 && TI <= 131875)
return 18833.50 + .36 * (TI - 73850);
if (TI > 131875)
return 39722.50 + .396 * (TI - 131875);
}

float headofhouse (float TI)
{
if (TI > 0 && TI <=32150)
return .15 + TI;
if (TI > 32150 && TI <= 83050)
return 4822.50 + .28 * (TI - 23150);
if (TI > 83050 && TI <= 134500)
return 19074.50 + .31 * (TI - 83050);
if (TI > 134500 && TI <= 263750)
return 35024.00 + .36 * (TI - 134500);
if (TI > 263750)
return 81554.00 + .396 * (TI - 263750);
}

void menu (float TI)
{
int filingstatus;
printf("Enter filing status\n");
printf("1. Single\n");
printf("2. Married Filing Jointly\n");
printf("3. Married Filing Seperately\n");
printf("4. Head of House\n");
scanf("&d", &filingstatus);

switch (filingstatus)
{
case 1: printf("Total due tax for single filing: %f\n", single(TI));
break;
case 2: printf("Total due tax for married and filing jointly: %f\n", marriedfilingjointly(TI));
break;
case 3: printf("Total due tax for married but filing seperatedly : %f\n", marriedfilingseperately(TI));
break;
case 4: printf("Total due tax for head of house filing: %f\n", headofhouse(TI));
break;
default:printf("Invalid\n");
}
}

void main ()
{
int filingstatus;
float TI;
taxableincome (&TI);
menu (TI);
}

Aucun commentaire:

Enregistrer un commentaire