Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // read and save the records
- while (true)
- {
- // ask for records
- System.out.print("How many records? ");
- nStudents = new Double(cin.readLine()).intValue();
- Student aStudent = new Student();
- for (int i = 0; i < nStudents; i++)
- {
- System.out.print("Name: ");
- aStudent.name = cin.readLine();
- System.out.print("ID: ");
- aStudent.id = new Double(cin.readLine()).intValue();
- System.out.print("GPA: ");
- aStudent.gpa = new Double(cin.readLine()).floatValue();
- // add record to list, if it's not full
- if (nStudents < student.length)
- student[nStudents++] = aStudent;
- }
- break;
- } // while
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement