Skip to content

Instantly share code, notes, and snippets.

@jc245410
Created April 18, 2012 10:50
Show Gist options
  • Select an option

  • Save jc245410/2412806 to your computer and use it in GitHub Desktop.

Select an option

Save jc245410/2412806 to your computer and use it in GitHub Desktop.
A tax calculator which calculates tax depending on income for the year ending 30 June 2011.
% Basic Tay Payable Calculator for 2011
%
% ___________________________
% input income ---> |calc tax, medicare and lio | -----> output tax
% |___________________________|
%
%
clear
clc
%
%
%
%outline 1:
income = input('Please enter your income for the year 2011 ending June 30: ');
%
%
%outline 2: Calculates the tax dependent on your income
%
if income < 6000;
taxable = 0;
elseif income < 37000;
taxable = (income - 6000)*0.15;
elseif income < 80000 ;
taxable = (income - 37000)*0.30 + 4650;
elseif income < 180000;
taxable = (income - 80000)*0.37 + 17550;
elseif income >= 180000;
taxable = (income - 180000)*0.45 + 54550;
else
disp('Invalid income for the year 2011 entered, please enter a valid income. (Not negative)')
end
%
%outline 3: calculates the medicare levy tax
%
if income < 18839;
medicare = 0;
elseif income < 22163;
medicare = 0.10 * (income - 18840);
elseif income > 22163 ;
medicare = 0.015 * income;
else disp('Invalid income for the year 2011 entered, please enter a valid income . (Not negative)')
end
% calculates the totaltax without low income offset
totaltax = taxable + medicare;
% calculates the low income offset
if income < 30000;
%
if totaltax <= 1500;
lowincome = totaltax ;
elseif totaltax > 1500;
lowincome = 1500;
end
else income > 30000;
lowincome = 0;
end
%updates the totaltax to include low income offset
totaltax = totaltax - lowincome;
disp('The total tax required to be payed is: ')
disp(totaltax)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment