This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ll is ')
disp(W) T = input('What is the temperature? '); tscale = input('Is this in C or F? ','s'); if tscale == 'C' function tax = computeTaxML(income)
% Computes income tax for a graduated tax system using MAtlab
% style program % Put brackets into brackets array in function starting
% Put tax rates into taxrate array in function starting with lowest tax rate
% Call function with income as input argument
brackets = [0 7300 29700 71950 150150 326450];
taxrate = [0 10 15 25 28 33 35];
difftaxrates = taxrate(2:length(taxrate))-taxrate(1:length(taxrate)-1);
incomeLevels = income - brackets;
incomeToBeCounted = incomeLevels > 0.0;
incomeLevels = incomeToBeCounted.*incomeLevels;
taxes = incomeLevels.*difftaxrates/100;
tax = sum(taxes);
fprintf('Your tax on income of $%10.2f is $%10.2f\n', income, tax)...
View Full Document
This document was uploaded on 03/16/2014 for the course CS 106 at Mt. Holyoke.
- Spring '13