Code: Select all
public static void main(String[] args) {
String name;
int grade;
int choice;
int count = 0;
String number;
System.out.println("press 1 if you like to save id as integer, or press 2 to for a string ");
choice = s.nextInt();
Student[] array = new Student[NUM_OF_STUDENTS];
if (choice == 1) {
System.out.println("please enter student name :");
s.nextLine();
name = s.nextLine();
while (!name.isEmpty() && count != NUM_OF_STUDENTS) {
System.out.println("please enter student #" + (count + 1) + " grade :");
grade = s.nextInt();
array[count] = new Student(count + 1, name, grade);
count++;
...