Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,231 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,855 people online right now. Registration is fast and FREE... Join Now!




income tax

 
Reply to this topicStart new topic

income tax, i wonder when chargeabled income is greater than 250000 how can it cal

ally
13 Mar, 2007 - 05:58 AM
Post #1

New D.I.C Head
*

Joined: 12 Mar, 2007
Posts: 2


My Contributions
[#include <iostream.h>
#include <conio.h>
#include <iomanip.h>

void main()
{
//Declaration of variables
float salary, rental, dividend, donation, medical_exp1, sup_equip, inst_fees;
float medical_exp2, books, child_below, child_above, child_stud1, child_stud2, disabled_child;
float EPF_life_ins, edu_medical_ins, zakat, computer, gross, total_inc;
float individual = 8000, wife = 3000, disabled_ind, disabled_wife,inc_tax;
float total_reliefs, chg_inc, Tax, tax, tax1, tax2, self_rebate = 0, deduct, tax_pay;
int percent;
char more, disabled1, disabled2;

cout << "This is a tax computation program." << endl;
more = 'y';
//begin while statement
while (more == 'y') {
//body of while statement
cout << "\n\n1.\tSalary :RM ";
cin >> salary;
cout << "\n\tRental :RM ";
cin >> rental;
cout << "\n\tDividend:RM ";
cin >> dividend;

cout << "\n2.\tCash donation to an approved institution:RM ";
cin >> donation;

cout << "\n3.\tReliefs:" << endl;
cout << " \ti.\tMedical expenses for parents:RM ";
cin >> medical_exp1;
//if statement
if (medical_exp1 > 5000.00)
medical_exp1 = 5000.00;

cout << "\n\tii.\tAmount of purchase of supporting equipment for disabled self,"
<< "\t\t\tspouse,child or parent:RM ";
cin >> sup_equip;
//if statement
if (sup_equip > 5000.00)
sup_equip = 5000.00;

cout << "\n\tiii.\tIs the tax payer disabled?";
cout << "\'y\' for yes or \'n\' for no: ";
cin >> disabled1;
while (disabled1 != 'y' && disabled1 != 'n'){
cout << "\t\tWrong input,please re-enter: ";
cin >> disabled1;
}

cout << "\n \tiv.\tFees paid to any institution recognized by the government:"
<< "\t\t\tRM ";
cin >> inst_fees;
//if statement
if (inst_fees > 5000.00)
inst_fees = 5000.00;

cout << "\n \tv.\tMedical expenses for self,spouse or child suffering from"
<< "\t\t\tserious disease:RM ";
cin >> medical_exp2;
//if statement
if (medical_exp2 > 5000.00)
medical_exp2 = 5000.00;

cout << "\n \tvi.\tCost incurred for the purchase of books,journals or magazines:"
<< "\t\t\tRM ";
cin >> books;
//if statement
if (books > 500.00)
books = 500.00;

cout << "\n \tvii.\tIs his wife disabled?";
cout << "\'y\' for yes or \'n\' for no: ";
cin >> disabled2;
while (disabled2 != 'y' && disabled2 != 'n'){
cout << "\t\tWrong input,please re-enter: ";
cin >> disabled2;
}

cout << "\n \tviii.\tThe number of children below 18 years: ";
cin >> child_below;

cout << "\n \tix.\tThe number of children 18 years and above and schooling: ";
cin >> child_above;

cout << "\n \tx.\tThe number of children studying in an institution of"
<< "\t\t\t\thigher learning in Malaysia: ";
cin >> child_stud1;

cout << "\n \txi.\tThe number of children studying in an institution of"
<< "\t\t\t\thigher learning outside Malaysia: ";
cin >> child_stud2;

cout << "\n \txii.\tThe number of disabled children: ";
cin >> disabled_child;

cout << "\n \txiii.\tContributions to EPF or life insurance premiums:RM ";
cin >> EPF_life_ins;
//if statement
if (EPF_life_ins >5000.00)
EPF_life_ins = 5000.00;

cout << "\n \txiv.\tInsurance premiums for education or medical:RM ";
cin >> edu_medical_ins;
//if statement
if (edu_medical_ins > 3000.00)
edu_medical_ins =3000.00;

cout << "\n4.\tRebates:";
cout << "\n \ti.\tAmount of zakat/fitrah paid:RM ";
cin >> zakat;

cout << "\n \tii.\tCost of computer bought:RM ";
cin >> computer;
//if statement
if (computer > 400.00)
computer = 400.00;
cout << "& #092;n==========================================================================
==";
cout << "\n\nTax calculation: " << endl;
cout << setiosflags(ios::fixed);
cout << setiosflags(ios::right);
cout << setprecision(2);
cout << "\n\t\t" << setw(7) << "Income:" << setw(53) << "RM";
cout << "\n\t\t" << setw(6) << "Salary" << setw(54) << salary ;
cout << "\n\t\t" << setw(6) << "Rental" << setw(54) << rental;
cout << "\n\t\t" << setw(8) << "Dividend" << setw(52) << dividend;
gross = salary + rental + dividend;
cout << "\n\t\t" << setw(12) << "Gross income" << setw(48) << gross;
cout << "\tDeduct:" << endl;
cout << "\n\t\t" << setw(13) << "Cash donation" << setw(47) << donation;
cout << "\n\t\t------------------------------------------------------------";
total_inc = gross - donation;
cout << "\n\t\t" << setw(12) << "Total income" << setw(36) << "RM " << setw(12)
<< total_inc;
cout << "\n\t\t------------------------------------------------------------";

cout << "\n\tDeduct:";
cout << "\n\t\t" << setw(8) << "Reliefs:" << setw(52) << "RM";

cout << "\n\t\t" << setw(10) << "Individual" << setw(50) << individual;
disabled_ind = 0;
if (disabled1 == 'y'){
disabled_ind = 5000.00;
cout << "\n\t\t" << setw(18) << "Tax payer disabled" << setw(42) << disabled_ind;
}
cout << "\n\t\t" << setw(4) << "Wife" << setw(56) << wife;
disabled_wife = 0;
if (disabled2 == 'y'){
disabled_wife = 2500.00;
cout << "\n\t\t" << setw(13) << "Disabled wife" << setw(47) << disabled_wife;
}
//if statement
if (medical_exp1 > 0){
cout << "\n\t\t" << setw(28) << "Medical expenses for parents" << setw(32) << medical_exp1;
}
if (sup_equip > 0){
cout << "\n\t\t" << setw(32) << "Purchase of supporting equipment" << setw(28) << sup_equip;
}
if (medical_exp2 > 0){
cout << "\n\t\t" << setw(37) << "Medical expenses for serious diseases" << setw(23)
<< medical_exp2;
}
if (inst_fees > 0){
cout << "\n\t\t" << setw(28) << "Fees paid to any institution" << setw(32) << inst_fees;
}
if (books > 0){
cout << "\n\t\t" << setw(5) << "Books" << setw(55) << books ;
}
if (child_below > 0){
child_below *= 800.00;
cout << "\n\t\t" << setw(17) << "Children under 18" << setw(43) << child_below;
}
if (child_above > 0){
child_above *= 800.00;
cout << "\n\t\t" << setw(30) << "Children over 18 and schooling" << setw(30) << child_above;
}
if (child_stud1 > 0){
child_stud1 *= 3200.00;
cout << "\n\t\t" << setw(29) << "Children studying in Malaysia" << setw(31) << child_stud1;
}
if (child_stud2 > 0){
child_stud2 *= 800.00;
cout << "\n\t\t" << setw(34) << "Children studying outside Malaysia" << setw(26)
<< child_stud2;
}
if (disabled_child > 0){
disabled_child *= 5000.00;
cout << "\n\t\t" << setw(14) << "Disabled child" << setw(46) << disabled_child;
}
if (EPF_life_ins >0){
cout << "\n\t\t" << setw(30) << "EPF or life insurance premiums" << setw(30)
<< EPF_life_ins;
}
if (edu_medical_ins > 0){
cout << "\n\t\t" << setw(43) << "Insurance premiums for education or medical" << setw(17)
<< edu_medical_ins;
}

total_reliefs = individual+wife+disabled_ind+disabled_wife+medical_exp1+sup_equip+medical_exp2+
books+inst_fees+child_below+child_above+child_stud1+child_stud2+disabled_child+
EPF_life_ins+edu_medical_ins;

cout << "\n\t\t------------------------------------------------------------" << endl;
cout << "\t\t" << setw(13) << "Total reliefs" << setw(35) << "RM " << setw(12) << total_reliefs;
cout << "\n\t\t------------------------------------------------------------" << endl;
chg_inc = total_inc - total_reliefs;
cout << "\n\t\t" << setw(19) << "Chargeabled income:" << setw(29) << "RM " << setw(12)
<< chg_inc << endl;
cout << "\nTax computation:" << endl;
//begin if...else statement
if (chg_inc > 250000){
Tax = 250000.00;
tax1 = 54975;
tax = (chg_inc - Tax);
tax2 = tax * 0.28;
}
else
if (chg_inc > 100000){
Tax = 100000;
tax1 = 14475;
tax = (chg_inc - Tax);
tax2 = tax * 0.27;
}
else
if (chg_inc > 70000){
Tax = 7000;
tax1 = 7275;
tax = (chg_inc - Tax);
tax2 = tax * 0.24;
}
else
if (chg_inc > 50000){
Tax = 50000;
tax1 = 3475;
tax = (chg_inc - Tax);
tax2 = tax * 0.23;
}
else
if (chg_inc > 35000) {
Tax = 35000;
tax1 = 1525;
tax = (chg_inc - Tax);
tax2 = tax * 0.13;
}
else
if (chg_inc > 20000){
Tax = 20000;
tax1 = 475;
tax = (chg_inc - Tax);
tax2 = tax * 0.07;
}
else
if (chg_inc > 5000){
Tax = 5000;
tax1 = 25;
tax = (chg_inc - Tax);
tax2 = tax * 0.03;
}
else
if (chg_inc > 2500){
Tax = 2500;
tax1 = 0;
tax = (chg_inc - Tax);
tax2 = tax * 0.01;
}
else {
Tax = 2500;
tax1 = 0;
tax2 = 0;
}//end of if...else statement
percent = tax2 /tax * 100;
cout << "\t\t" << setw(19) << "Tax on the first RM "<<Tax << "\t\t RM " << setw(12)
<< tax1 << endl;
cout << "\t\t" << "Tax on the next RM " << tax << " @ "
<< percent << "% \t RM " << setw(12) << tax2 << endl;
cout << "\t\t------------------------------------------------------------" << endl;
inc_tax = tax1 + tax2;
cout << "\t\t" << setw(17) << "Total income tax:" << setw(31) << "RM " << setw(12)
<< inc_tax << endl;
cout << "\t\t------------------------------------------------------------" << endl;
cout << "\t\tDeduct:" << endl;
//if statement
if (chg_inc < 35000){
self_rebate = 350;
cout << "\t\t" << setw(12) << "Self rebates" << setw(36) << "RM " << setw(12)
<< self_rebate;
}
if (zakat > 0){
cout << "\n\t\t" << setw(13) << "Zakat rebates" << setw(35) << "RM " << setw(12)
<< zakat;
}
if (computer > 0){
cout << "\n\t\t" << setw(16) << "Computer rebates" << setw(32) << "RM " << setw(12)
<< computer;
}

deduct = self_rebate + zakat + computer;
tax_pay = inc_tax - deduct;
//begin if...else statement
if (tax_pay > 0) {
cout << "\n\n\t\t" << setw(11) << "Tax payable" << setw(37) << "RM " << setw(12)
<< tax_pay << endl;
}
else {
cout << "\n\n\t\tTotal income tax - Rebate < 0,thus" << endl;
cout << "\t\t" << setw(12) << "Tax payable:" << setw(36) << "RM " << setw(12)
<< "0.00" << endl;
}//end of if...else statement
cout << "& #092;n==========================================================================
==";
cout << "\n\n\nDo you want to continue?(type \'y\' for yes or \'n\' for no) ";
cin >> more;
while (more != 'y' && more != 'n'){
cout << "Wrong input,please re-enter:";
cin >> more;
}//end while
if (more == 'n')
cout << "\n\nPress any key to exit...";
}//end while
getch();
}//end main ]
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Income Tax
13 Mar, 2007 - 06:02 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,230



Thanked: 40 times
Dream Kudos: 25
My Contributions
Can you specify any errors you are receiving, or provide a description of the undesired behaviour being exhibited? I'm afraid I may have missed the question.
User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 03:22PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month