### 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
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..
 ``1234567891011121314`` ``````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

 ``12345678910`` ``````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

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173`` ``````#include #include 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 "<

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.