I am now doing JustBASIC in my programming class. I am in the process of making a program that will print a report. Part of the grading for the report is setting up a good layout for the page that will print.
My question is how do I properly format the code the print a page properly from the printer? Thanks for any help and input in how to do this last part properly.
The assignment:Plan and write a program to meet the following requirements.
Have the user (the person running the program) enter the name of the first student.
Check to see if this is the last person (end of file check).
If it is not the end of file, have the user enter three scores between 0 and 100 inclusive. It is not necessary to do error checking, you can assume that the user will enter scores in the correct range.
Calculate the average of the three scores.
Store the name and the average is appropriate arrays.
Have the user enter the next name or the end of file check. (This might be a loop.)
AFTER all the data has been entered, have the program print a report on the screen that includes a title (the title for this report must include your name, i.e. Lew Schmitt’s Grade Report), column headings and a report line for each student giving their name and average, correct to one decimal place. The overall appearance of the report is part of the grading criteria.
The program should work for any number of students up to twenty. You do not need to check for more than 20; there will never be more than 20 students in a class.
Only the output report should show on the screen, not the input. Think CLS.
The first lines of the program source code must be comments containing your name, the date the program was started and the purpose of the program. Include other comments as appropriate.
CODE
' Purpose: To be able to print a report of the entered student data, displaying the students name
' and grade average. Making sure it is corrected to one decimal place.
DIM student$(20)
DIM average(20)
' x is a counter
x = 0
' input section
CLS
INPUT "Enter the name of the student: "; student$
DO WHILE student$ <>""
INPUT "Enter the first score: "; score1
INPUT "Enter the second score: "; score2
INPUT "Enter the third score: "; score3
'Calculate the average
avg = (score1 + score2 + score3) / 3
x = x + 1
names$(x) = student$
average(x) = avg
CLS
INPUT "Enter the next students name or press ENTER when finished: "; student$
LOOP
CLS
' Print the report
PRINT " Jeremy D. Lynch's Grade Report "
PRINT " STUDENTS NAME: GRADE AVERAGE: "
FOR c = 1 to x
PRINT TAB (13); names$(c); TAB (34); USING("###.#", average(c))
NEXT c
END