This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { ---------------------------------------------------------- Program Description: This program will allow the user to compute their electric bill. pg.351 #22. ------------------------------------------------------------} program Grades; var Scores: array[1..50] of integer; Students: array[1..50] of integer; {----------------------------------------------------------- PromptForInput: This procedure prompts the user to enter the number of kilowatt hours used this month. ------------------------------------------------------------} Procedure InputData(var kwhrs:real); begin writeln('Enter the number of kilowatt hours used this month:'); readln(kwhrs); end; {------------------------------------------------------------ CalculateData: This procedure calculates the bill amount. -------------------------------------------------------------} Procedure CalcData(var exscore: real); var avg:= real; begin For I: 1 to 50 do begin exscore:= 0; For I: 1 to 50 do begin write('Enter the exam score:'); readln(exscore[I]); exscore[I]:= exscore[I]+exscore[I]; end; avg:= exscore[I]/50; If exscore[I]>= (avg - 10) grade:= F; end; {------------------------------------------------------------- OutputResult: This procedure outputs the bill amount. --------------------------------------------------------------} Procedure OutputData(area:real); {------------------------------------------------------------- MainProgram: This is the main program that calls the procedures to calculate the amount of the electric bill. ---------------------------------------------------------------} begin InputData(kwhours); {calls the InputData procedure} CalcData(kwhours,bill); {calls the CalcData procedure} OutputData(bill); {calls the OutputData procedure} end. {program} ...
View Full Document