I'm trying to convert data that's entered as a real number into integer data to be used in a do loop. The problem is that it keeps telling me that the numbers I've just converted are not scalar integers...
The Attempt at a Solution
REAL :: r !Monthly interest rate
REAL :: pay !Montyly Payment Amount
REAL :: p !Initial loan amount (Money borrowed)
INTEGER :: n, i, j !Total number of payments to be made
REAL :: i_max !Maximum Interest rate
REAL :: i_min !Minimum Interest rate
REAL :: t_max !Maximum amount of Time for Loan payback
CHARACTER :: x
WRITE (*,*) 'COP 2271- Project 2'
WRITE (*,*) ' Interest rates '
WRITE (*,*) '-------------------------'
WRITE (*,*) 'Main Menu'
WRITE (*,*) ' A) Enter new Data'
WRITE (*,*) ' Q) Quit'
READ (*,*) x
SELECT CASE (x)
WRITE (*,*) 'Enter principle loan amount($)'
READ (*,*) p
WRITE (*,*) 'Enter maximum length of the loan(Years):'
READ (*,*) t_max
WRITE (*,*) 'Enter minimum interest rate(%):'
READ (*,*) i_min
WRITE (*,*) 'Enter maximum interest rate(%):'
READ (*,*) i_max
WRITE (*,*) 'Invalid Selection'
IF (p < 0) WRITE (*,*) 'ERROR- Principle amount must be positive!'
IF (t_max < 3) WRITE (*,*) 'ERROR- Maximum loan length must be greater than or equal to 3 (years)!'
IF (i_min < 0 .OR. i_min > 100 .OR. i_min > i_max) WRITE (*,*) 'Error- Interest rate must be between 0 and 100!'
IF (i_max < 0 .OR. i_max > 100) WRITE (*,*) 'Error- Interest rate must be between 0 and 100!'
i_max = CEILING(i_max)
i_min = INT(i_min)
t_max = CEILING(t_max)
DO i = 2, t_max
n = 12*i
pay = (r*p)/(1-((1 + r)**(-n)))
DO j = i_min, i_max
WRITE (*,'(3X,I3,8X,I3,5X,A,F10.2, 5X,A, F10.2)')
end program interest
-This is the program as I've written it so far, it's not finished... I'm also having problems with the formatting they want us to use for the tables.