A Run of the Program

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

No. Variables can be declared in the middle of a program. You should declare them in whatever location makes the program easiest to understand.

A Run of the Program

Here (again) is a sample data file for the program, called student.data.

3          
87
98
95
4          
78
82
91
84

Here is a sample run of the program.

C:/users/default/JavaLessons>java TestGroups

File name? student.data
Group A average: 93.33333333333333
Group B average: 83.75

C:/users/default/JavaLessons>

QUESTION 12:

  1. How will the user indicate if group has no data?
  2. Will the program run correctly if one or more groups has no data?