PROGRAM PGM03 *********************************************************** * PROGRAMMER: B. Alex Bridges * CLASS: 9:00AM * PROGRAM: PGM03.F * DUE DATE: 01/28/99 * * Program Description: * This program reads data from a data file. It uses the * data to calculate the new total honor points and credit * hours as well as the new current and cummulative GPA. * Variables: * NAMEF : the student's first name * NAMEL : the student's last name * CH1 : the student's credit hours for class #1 * GRADE1 : the student's grade for class #1 * CH2 : the student's credit hours for class #2 * GRADE2 : the student's grade for class #2 * CH3 : the student's credit hours for class #3 * GRADE3 : the student's grade for class #3 * CH4 : the student's credit hours for class #4 * GRADE4 : the student's grade for class #4 * HPOLD : the student's old honor points * HPNEW : the student's new honor points * HPTOT : the student's total honor points * CHOLD : the student's old credit hours * CHNEW : the student's new credit hours * CHTOT : the student's total credit hours * GPAOLD : the student's old GPA * GPACUR : the student's current GPA * GPACUM : the student's cummulative GPA * Input : NAMEF,NAMEL,GPAOLD,CHOLD,CH1,CH2,CH3,CH4, * GRADE1,GRADE2,GRADE3,GRADE4 * Output : HPOLD,HPNEW,HPTOT,CHTOT,GPACUR,GPACUM *********************************************************** CHARACTER*5 NAMEF,NAMEL*7 REAL CH1,GRADE1,CH2,GRADE2,CH3,GRADE3,CH4,GRADE4 REAL HPOLD,HPNEW,HPTOT REAL CHOLD,CHNEW,CHTOT REAL GPAOLD,GPACUR,GPACUM * open the data file OPEN (UNIT=12, FILE="pgm03.dat") * read in values for NAMEF,NAMEL READ (12, *), NAMEL,NAMEF * read in values for GPAOLD,CHOLD READ (12, *), GPAOLD,CHOLD * read in values for CH1,CH2,CH3,CH4 READ (12, *), CH1,CH2,CH3,CH4 * read in values for GRADE1,GRADE2,GRADE3,GRADE4 READ (12, *), GRADE1,GRADE2,GRADE3,GRADE4 * close the data file CLOSE (12) * calculate the old, new, and total honor points HPOLD = GPAOLD * CHOLD HPNEW = CH1*GRADE1 + CH2*GRADE2 + CH3*GRADE3 + CH4*GRADE4 HPTOT = HPOLD + HPNEW * calculate the old, new, and total credit hours CHOLD = CHOLD CHNEW = CH1 + CH2 + CH3 + CH4 CHTOT = CHOLD + CHNEW * calculate the old, current, and cummulative GPA GPAOLD = GPAOLD GPACUR = HPNEW / CHNEW GPACUM = HPTOT / CHTOT * display the output PRINT '(T35, "STUDENT INPUT DATA")' PRINT '("STUDENT NAME: ", A, A)', NAMEF,NAMEL PRINT '("OLD GPA: ", F4.1, T30, "OLD CREDIT HRS: ", F4.1, /)', 1 GPAOLD,CHOLD PRINT '("CRHR#1: ", F3.1, T15, "CRHR#2: ", F3.1, T30, 1 "CRHR#3: ", F3.1, T45, "CRHR#4: ", F3.1)', 2 CH1,CH2,CH3,CH4 PRINT '("GRAD#1: ", F4.1, T15, "GRAD#2: ", F4.1, T30, 1 "GRAD#3: ", F4.1, T45, "GRAD#4: ", F4.1)', 2 GRADE1,GRADE2,GRADE3,GRADE4 PRINT '(T35, "STUDENT OUTPUT DATA")' PRINT '("OLD HONOR PTS: ", T25, F6.1)', HPOLD PRINT '("NEW HONOR PTS: ", T25, F6.1)', HPNEW PRINT '("TOTAL HONOR PTS: ", T25, F6.1, /)', HPTOT PRINT '("OLD CREDIT HOURS: ", T25, F6.1)', CHOLD PRINT '("NEW CREDIT HOURS: ", T25, F6.1)', CHNEW PRINT '("TOTAL CREDIT HOURS: ", T25, F6.1, /)', CHTOT PRINT '("CURRENT GPA: ", T25, F6.1)', GPACUR PRINT '("CUMMULATIVE GPA: ", T25, F6.1)', GPACUM * print end of program message PRINT '(T35, "End of program - PGM03.F")' END