Fortran 90: Calculating Tax Brackets for Income

  • Comp Sci
  • Thread starter DoremiCSD
  • Start date
  • Tags
    Fortran
In summary, the user needs to enter the number of tax brackets, the lower limit of each bracket, and the corresponding tax rate. Then, the program should be able to calculate the tax for a given income based on these inputs. It is important to ensure that the brackets are in ascending order and that the program can handle any number of brackets. Additionally, the user needs to be able to enter the income for which they want to calculate the tax.
  • #1
DoremiCSD
10
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
  • #2
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.
 

Related to Fortran 90: Calculating Tax Brackets for Income

1. What is Fortran 90?

Fortran 90 is a high-level programming language used for scientific and engineering applications. It is an extension of the original Fortran language and was released in 1991.

2. How is Fortran 90 different from previous versions of Fortran?

Fortran 90 introduced new features such as dynamic memory allocation, modules, and recursion. It also has improved support for structured programming and user-defined data types.

3. How can Fortran 90 be used to calculate tax brackets for income?

Fortran 90 has built-in functions for mathematical operations, making it well-suited for calculating tax brackets. The programmer would need to input the income and tax rate data and use conditional statements to determine the appropriate tax bracket and calculate the tax amount.

4. Is Fortran 90 still commonly used today?

While it may not be as widely used as other programming languages, Fortran 90 is still commonly used in scientific and engineering fields. Many legacy systems and programs are also written in Fortran 90, making it a valuable skill for programmers to have.

5. Are there any resources available for learning Fortran 90?

Yes, there are many online tutorials, books, and courses available for learning Fortran 90. Some popular resources include the official Fortran website, online forums, and video tutorials on platforms like YouTube.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
  • Programming and Computer Science
Replies
9
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Programming and Computer Science
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
Back
Top