# Homework Help: Fortran 90 Question

1. Feb 29, 2012

### DoremiCSD

1. The problem statement, all variables and given/known data
The program should make should calculate the tax that corresponds to some income. The user gives

1. A natural number n is the length of the list at minus 2 and a length of 3 in the list below and equal to the number of rows in the table above non-header line and last line. In the above table the value of n is 7. We have 1 <= n <= 9.

Register as an integer :: n.

2. A list of real numbers corresponding to the first column of the table above except the heading and the last element (which can be calculated as the sum of all elements above it). The length of the list is n (the user is given).

Declare as real :: bracket (10).

3. A list of real numbers in [0.100] for the second column of the table above except header. The length of the list is n 1 (n has to give the user).

Declare as real :: percent (10).

4. Income.

Declare it as real :: income.

2. Relevant equations
i have to create a program that is doing this:
How many tax brackets?

3

Tax bracket 1:

10000

Percentage for tax bracket 1:

5

Tax bracket 2:

5000

Percentage for tax bracket 2:

10

but i dont know how to show the number in front of bracket:"The tax bracket (1..2):"

3. The attempt at a solution
do i=1,n
print *, "Tax bracket:"
end do

do i=1,n
print *, "Percentage for tax bracket ?:"
end do

2. Mar 1, 2012

### Staff: Mentor

Based on your sample input, the user enters 3 for the number of tax brackets. The lower limit for bracket 1 is 10,000 (dollars? euros?), and the tax rate is 5%. The lower limit for bracket 2 is 5,000, which doesn't make sense. Did you mean 50,000? The tax rate for bracket 2 is 10%.

What about the 3rd bracket? Are these the brackets?
Bracket 1: 0 - 9,999 - tax rate 0%
Bracket 2: 10,000 - 49,999 - tax rate 5%
Bracket 3: 50,000 and higher - tax rate 10%

I'm assuming you meant 50,000 instead of 5,000.

Now we come to the heart of the problem - computing the tax for a given income. Do you know how to manually calculate the tax on incomes of, say, 8,000, 12,500, and 55,000? See if you can figure those out by hand, and then we'll talk about how you can implement these calculations in Fortran.