Problem with Pascal for Mr. marko_svaljek ...

Sylvester_usmc
Sylvester_usmc used Ask the Experts™
on
Thanks for your help...
The input file is just a Notepad file wich has different scores:
Scores.txt
100
56
98
74
86
90
And the output file is rpt.txt with the numeric grade first and then the letter that correspond to that numeric grade, and at the end I need the average numeric grade "rounded" as an integer using the round fuction. Example: Average of 87.8 should print 88
NUMERIC      LETTER  
 GRADE       GRADE
  XXX          X
  XXX          X

  XXX          X   AVERAGE
Thanks
Sylvester

Write a function called Grader that takes a numeric score and returns a letter grade. Grader has one argument of type integer and returns a value of type Char.
Use the rules that 90-100=A, 80-90=B, etc.
Embed the function in a program that has an input controlled loop which reads the numeric score and writes the numeric ad letter grades to a file plus writes the class average as a numeric and a letter grade.
NUMERIC      LETTER  
 GRADE       GRADE
  XXX          X
  XXX          X

  XXX          X   AVERAGE
Average numeric grade is "rounded" and is an integer.
Use Pascal's built-in ROUND function.
Example: Average of 87.8 should print 88

Thanks  
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
Sounds like homework.  What code have you written thus far?  Do you have a specific question we can answer.

mlmcc

Author

Commented:
This is the actual problem:(What I got so far is at the botton)
Write a function called Grader that takes a numeric score and returns a letter grade. Grader has one argument of type integer and returns a value of type Char.
Use the rules that 90-100=A, 80-90=B, etc.
Embed the function in a program that has an input controlled loop which reads the numeric score and writes the numeric ad letter grades to a file plus writes the class average as a numeric and a letter grade.
NUMERIC      LETTER  
 GRADE       GRADE
  XXX          X
  XXX          X

  XXX          X   AVERAGE
Average numeric grade is "rounded" and is an integer.
Use Pascal's built-in ROUND function.
Example: Average of 87.8 should print 88


This is what I got so far:

function grader(grade:integer):char;
var temp:char;
begin
if ((grade>=90)and(grade<=100)) then temp:='A';
if ((grade>=80)and(grade<90)) then temp:='B';
if ((grade>=70)and(grade<80)) then temp:='C';
if ((grade>=60)and(grade<70)) then temp:='D';
if ((grade>=50)and(grade<60)) then temp:='E';
if ((grade>=0)and(grade<50)) then temp:='F';
grader=temp;
end;
I had no time to answer that.
You just accepted answer from mlmcc.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial