Need help

Personal Deductions:
Single = 9, 000.00
Head of the Family = 12, 000.00
Married = 18, 000.00
Additional Deduction / Exemption:
8, 000.00 / dependent
Note: Maximum of four (4) dependents
TAX TABLE
TAXABLE INCOME TAX DUE
<= 2, 500.00 0%
> 2, 500.00 && <= 5, 000.00 1%
> 5, 000.00 && <= 10, 000.00 25.00 + 3% of excess over 5,000.00
> 10, 000.00 && <= 20, 000.00 175.00 + 7% of excess over 10,000.00
> 20, 000.00 && <= 40, 000.00 875.00 + 11% of excess over 20,000.00
> 40, 000.00 && <= 60, 000.00 3, 075.00 + 15% of excess over40,000.00
> 60, 000.00 && <= 100,000.00 6, 075.00 + 19% of excess over 60,000.00
> 100, 000.00 13,675.00 + 24% of excess over100,000.00

INPUT REQUIREMENT:
1. Name of Taxpayer
2. TIN (Tax Identification Number)
3. Gross Income (Annual Income)
4. Civil Status (Single, Married, or Head of the Family)
5. Number of Dependents
PROCESS:
1. Get the name of Taxpayer, his/her TIN and Gross Income.
2. Get the Civil Status
3. If Civil_Status != “Single”, get the number of dependents.
4. Compute for the taxable income.
a. Taxable Income = Gross Income – Total Exemption
b. Total Exemption = Personal Deduction + Additional Exemption
5. Get the tax due.
PROGRAM SPECIFICATION:
1. Include necessary validation codes.
2. Use at least three (3) functions.
a. To get the Personal Deduction.
b. To get the Additional Exemption.
c. To get the tax due.
3. Use a loop. This would allow the user to execute the program as many times as the user wants to.


my question is:

1.) how should i use the functions?
2.) what header file/s will i use?

i'm having a hard time coding this.thanks
read program specification
Hey, i'm still having a hard time..i dont know where to start
if that's C++... you should first include <iostream>.. you can include other header files if you need them.

second.. follow what the program specification says.. It says that you need to use at least 3 functions.. so..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
PersonalDeduction(parameters here..)
{ 
     your codes here..
}
AdditionalExemption(parameters here...)
{
     your codes here.. 
}
TaxDue(parameters here...)
{
     your codes here.. 
}

and your main().....


you can add another function if you need it... and it says you need to use for loop somewhere inside those functions...

read the process requirement.. good luck...
Last edited on
Well i didn't start coding but what i did is the loop

1
2
3
4
5
6
7
8
9
10
char ans;
do
{
 codes here....
}
cout<<"do you want to continue? [y/n]";
}while ( ans == 'Y' || ans == 'y');
{
cout<<"thank you!";
}


btw, how should i use functions..i read everything about it but i just don't get it..
Last edited on
for example... a function that returns a int..

int foo ()
{
return 5;
}


void main()
{
cout << foo() << endl;

int x = foo();

cout << x << endl;
}






/////////////////


Functions are basically to isolate parts of code. If you will use the same code several times, wop!! you should put it in a function! ;)


Start from there =)
Okay so i finished coding..thanks for helping

BUT..i cant run my code because of several problems and i dont know why

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#include <iostream>
#include <string>
using namespace std;

void tax1(); void tax2();void tax3();void tax4();void tax5();void tax6();void tax7();void tax8(); 
char ans1,ans2,status;
int Single=9000;
int Married=18000;
int Head=12000;
double grossinc,exemption,taxinc,dependents1,dependents2;
string name;
string tin;
int main()

{

     
     cout<<"\t\t\t=====TAX COMPUTATION=====\n\n\n";
     cout<<"Enter your Name: ";
     cin>>name;
     cout<<"Enter your TIN (Tax Identification Number) : ";
     cin>>tin;
     cout<<"Enter your Gross Income: Php ";
     cin>>grossinc;
     cout<<"Civil Status: \t\t[S]Single\n\t\t\t[M]Married\n\t\t\t[H]Head Of The Family\nEnter your Civil Status: ";
     cin>>status;
     
     if (status == 'S' || status == 's')
     {
        exemption = Single ; 
        taxinc = grossinc-exemption;
                          if(taxinc <=2500.00) tax1();
                                  else if(taxinc>2500.00 && taxinc <=5000.00)tax2();
                                  else if(taxinc>5000.00 && taxinc <=10000.00)tax3();
                                  else if(taxinc>10000.00 && taxinc <=20000.00)tax4();
                                  else if(taxinc>20000.00 && taxinc <=40000.00)tax5();
                                  else if(taxinc>40000.00 && taxinc <=60000.00)tax6();
                                  else if(taxinc>60000.00 && taxinc <=100000.00)tax7();
                                  else if(taxinc>100000.00)tax8();
     }
     else if (status == 'M' || status == 'm')
     {
          cout<<"Do you have any dependents? [Y/N]: ";
          cin>>ans1;
     }
     else if (ans1 == 'Y' || ans1 == 'y')
     {
          cout<<"How many dependents?: ";
          cin>>dependents1;
                    if(dependents1 >=1 && dependents1 <=4)dependents2=dependents1*8000;
                           else if( dependents1 >4 ) dependents2= 4*8000;
                           exemption = Married + dependents2; taxinc = grossinc-exemption; 
                           if(taxinc <=2500.00) tax1();
                           else if(taxinc>2500.00 && taxinc <=5000.00)tax2();
                           else if(taxinc>5000.00 && taxinc <=10000.00)tax3();
                           else if(taxinc>10000.00 && taxinc <=20000.00)tax4();
                           else if(taxinc>20000.00 && taxinc <=40000.00)tax5();
                           else if(taxinc>40000.00 && taxinc <=60000.00)tax6();
                           else if(taxinc>60000.00 && taxinc <=100000.00)tax7();
                           else if(taxinc>100000.00)tax8();
     }
     else if ( ans1 == 'N' || ans1 == 'n')
     {
          cout<<"Okay then, let us proceed to the next step.";
     }
     else if ( status == 'H' || status == 'h')
     {
          cout<<"Do you have any dependents? [Y/N]: ";
          cin>>ans1;
     }
     else if (ans1 == 'Y' || ans1 == 'y')
     {
          cout<<"How many dependents?: ";
          cin>>dependents1;
            if(dependents1 >=1 && dependents1 <=4)dependents2=dependents1*8000;
                           else if( dependents1 >4 ) dependents2= 4*8000;
                           exemption = Head + dependents2; taxinc = grossinc-exemption; 
                           if(taxinc <=2500.00) tax1();
                           else if(taxinc>2500.00 && taxinc <=5000.00)tax2();
                           else if(taxinc>5000.00 && taxinc <=10000.00)tax3();
                           else if(taxinc>10000.00 && taxinc <=20000.00)tax4();
                           else if(taxinc>20000.00 && taxinc <=40000.00)tax5();
                           else if(taxinc>40000.00 && taxinc <=60000.00)tax6();
                           else if(taxinc>60000.00 && taxinc <=100000.00)tax7();
                           else if(taxinc>100000.00)tax8();
     }
     else if ( ans1 == 'N' || ans1 == 'n')
     {
          cout<<"Okay then, let us proceed to the next step.";
     }
     else
     {
          cout<<"Please choose the exact civil status so i can proceed.";
     }
          cout<<"Do you want to try my TAX COMPUTATION again? [Y/N]: ";
          cin>>ans2;
          
          if ( ans2 == 'N' || ans2 == 'n')
          {
               cout<<" THANK YOU VERY MUCH FOR USING MY TAX COMPUTATION PROGRAM!\n"
                   <<" I HOPE TO SEE YOU SOON! GRACIAS DE NUEVO!\n\n\n\n";
          }
system("pause");
}



void tax1()
{
   cout<<"The Total Exemption is : Php "<<exemption<<endl
       <<"The Taxable Income is : Php "<<taxinc<<endl
       <<"And your TAX DUE is 0%\n";
}
void tax2()
{
   cout<<"The Total Exemption is : Php "<<exemption<<endl
       <<"The Taxable Income is : Php "<<taxinc<<endl
       <<"And your TAX DUE is 1%\n"
       <<"All in all , your TAX is: Php "<<taxinc*0.01<<endl;
}
void tax3()
{
   cout<<"The Total Exemption is : Php "<<exemption<<endl
       <<"The Taxable Income is : Php "<<taxinc<<endl
       <<"And your TAX DUE is Php 25.00 + 3% of the taxable income\n"
       <<"All in all , your TAX is: Php "<<(taxinc*0.03)+25.00<<endl;
}
void tax4()
{
   cout<<"The Total Exemption is : Php "<<exemption<<endl
       <<"The Taxable Income is : Php "<<taxinc<<endl
       <<"And your TAX DUE is Php 175.00 + 7% of the taxable income\n"
       <<"All in all , your TAX is: Php "<<(taxinc*0.07)+175.00<<endl;
}
void tax5()
{
   cout<<"The Total Exemption is : Php "<<exemption<<endl
       <<"The Taxable Income is : Php "<<taxinc<<endl
       <<"And your TAX DUE is Php 875.00 + 11% of the taxable income\n"
       <<"All in all , your TAX is: Php "<<(taxinc*0.11)+875.00<<endl;
}
void tax6()
{
   cout<<"The Total Exemption is : Php "<<exemption<<endl
       <<"The Taxable Income is : Php "<<taxinc<<endl
       <<"And your TAX DUE is Php 3,075.00  + 15% of the taxable income\n"
       <<"All in all , your TAX is: Php "<<(taxinc*0.15)+3,075.00<<endl;
}
void tax7()
{
   cout<<"The Total Exemption is : Php "<<exemption<<endl
       <<"The Taxable Income is : Php "<<taxinc<<endl
       <<"And your TAX DUE is Php 6,075.00  + 19% of the taxable income\n"
       <<"All in all , your TAX is: Php "<<(taxinc*0.19)+6,075.00<<endl;
}
void tax8()
{
   cout<<"The Total Exemption is : Php "<<exemption<<endl
       <<"The Taxable Income is : Php "<<taxinc<<endl
       <<"And your TAX DUE is Php 13,675.00  + 24% of the taxable income\n"
       <<"All in all , your TAX is: Php "<<(taxinc*0.24)+13,675.00<<endl;
}

               




               


               


that's my code( long isn't it?) the error says:

"invalid operands of types `double' and `<unknown type>' to binary `operator<<'

EDIT:TYPO
Last edited on
Topic archived. No new replies allowed.