Fortran 90: Calculating Tax Brackets for Income

  • Context: Comp Sci 
  • Thread starter Thread starter DoremiCSD
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

The discussion focuses on creating a Fortran 90 program to calculate tax based on user-defined income and tax brackets. The program requires the user to input the number of tax brackets, the lower limits for each bracket, and the corresponding tax percentages. Key points include the correct interpretation of tax brackets, with examples provided for incomes of 8,000, 12,500, and 55,000. The participants clarify the need for accurate bracket definitions and suggest a correction from 5,000 to 50,000 for the second bracket.

PREREQUISITES
  • Understanding of Fortran 90 syntax and data types
  • Knowledge of tax bracket structures and calculations
  • Ability to read user input in Fortran
  • Familiarity with control structures such as loops in Fortran
NEXT STEPS
  • Implement user input handling for tax brackets in Fortran 90
  • Learn how to calculate cumulative tax based on defined brackets
  • Explore error handling techniques in Fortran for user input validation
  • Study examples of Fortran programs that perform financial calculations
USEFUL FOR

Students learning Fortran programming, software developers working on financial applications, and anyone interested in implementing tax calculation algorithms in Fortran.

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 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K