A good answer might be:No. Variables can be declared in the middle of a program. You should declare them in whatever location makes the program easiest to read. |
A Run of the ProgramHere (again) is a sample data file for the program, called student.data. Here is a sample run of the program. The user prompts have been left in:3 87 98 95 4 78 82 91 84 C:\users\default\JavaLessons>java TestGroups < student.data How many students in group A: Enter a number: Enter a number: Enter a number: Group A average: 93.33333333333333 How many students in group B: Enter a number: Enter a number: Enter a number: Enter a number: Group B average: 83.75 C:\users\default\JavaLessons> |
QUESTION 12:
|