Comp Sci Fortran 90: Calculating Tax Brackets for Income

  • Thread starter Thread starter DoremiCSD
  • Start date Start date
  • Tags Tags
    Fortran
AI Thread Summary
The discussion focuses on creating a Fortran 90 program to calculate taxes based on user-defined income and tax brackets. Users must input the number of tax brackets, their limits, and corresponding tax rates. There is confusion regarding the correct values for the tax brackets, particularly the second bracket, which should likely be 50,000 instead of 5,000. The conversation also emphasizes the importance of understanding manual tax calculations for various income levels before implementing them in code. Overall, the thread aims to clarify the program's requirements and ensure accurate tax bracket definitions.
DoremiCSD
Messages
10
Reaction score
0

Homework Statement


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.



Homework 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 don't know how to show the number in front of bracket:"The tax bracket (1..2):"



The Attempt at a Solution


do i=1,n
print *, "Tax bracket:"
read *, bracket(i)
end do

do i=1,n
print *, "Percentage for tax bracket ?:"
read *, percent(i)
end do
 
Physics news on Phys.org
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.
 

Similar threads

Replies
4
Views
2K
Replies
2
Views
6K
Replies
8
Views
2K
Replies
21
Views
3K
Replies
7
Views
1K
Back
Top