Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i defined it as stud. it didn't fix the problem. this is java private static void displayStudent Details(Student[] studArr, int ID) { for (Student stud
i defined it as stud. it didn't fix the problem.
this is java
private static void displayStudent Details(Student[] studArr, int ID) { for (Student stud : studArr) { if (stud.getStudentID) = ID) System.out.println(stud.toString(); } } Q15.java & Kinter Assignme... G Kinter Assignme... & Student.java S GRASP Messages Interactions Run I/O StudentMain.java:102: error: cannot find symbol if (stud.getStudentID() ID) symbol: method getStudentID) location : variable stud of type Student 8 G G StudentMain.java C:\Users camen Documents - GRASP CSD (Java) File Edit View Build Project Settings Tools Window Help afbo XO DEDO KIB All Files Sort By Name private static void de ca EetStudent IDFromUser(Scanner sc, Student []students) { C:\UsersicamenDocuments int ID - ; while (true) { Foo.class tryf Foo.java System.out.print("Enter a valid student ID enter a to quit): "); Food.class ID - Sc.nextInt(); Fruit.class if (ID == 0) { Homework 4 Part 2.docx System.out.println("Goodbye!"); Homework_28.docx break; Jill.jpg } if(ID 0 && numberOfStudents 9999999) throw new Exception(); sc.nextLine(); catch (Exception ex) { sc.nextLine(); } 11 System.out.println("Please input an integer between 1000000 and 9999999"); continue; 1 idvalid = true; } try{ System.out.print("Student " + (i+1) + "GPA: "); GPA = sc.nextDouble(); if (GPA 4) throw new Exception(); sc.nextLine(); } catch (Exception ex) { sc.nextLine(); System.out.println("Please input a valid GPA (0-4.0)"); continue; } students[i] = new Student (name, ID, GPA); break; } } break; } else{ System.out.println("I cannot create + number of Students + " students!"); } I } catch (Exception ex) { sc.nextLine(); System.out.println("Please input a number between 1 and 10."); continue; } } getStudent IDFromUser (sc, students); } private static void getStudent IDFromUser (Scanner sc, Student[]students){ int ID = 0; while (true) { try{ System.out.print("Enter a valid student ID (enter o to quit): "); ID = sc.nextInt(); } catch (Exception ex) { sc.nextLine(); System.out.println("Please input a number between 1 and 10."); continue; ) } get Student IDFromUser (sc, students); } private static void get Student IDFromUser (Scanner sc, Student[]students) { int ID = 0; while (true){ tryt System.out.print("Enter a valid student ID (enter to quit): "); ID = sc.nextInt(); if (ID == 0) { System.out.println("Goodbye!"); break; } if(ID 9999999) throw new Exception(); } catch(Exception ex) { sc.nextLine(); System.out.println("Please input an integer betypen 1000000 and 9999999"); continue; + } displayStudent Details(students, ID); } } private static void displayStudent Details(Student[] studArr, int ID) { for (Student stud : studArr) { if (stud.getStudentID() == ID) System.out.println(stud.toString(); } } } public class Student private String name; private int id; private double GPA; public Student() { } public Student(String name, int id, double GPA) { this.name = name; this.id = id; this.GPA = GPA; public void printStudent() { System.out.print(" Student name: "+name); System.out.print(" Student id: "+id); System.out.print(" GPA: "+GPA); ) public int getID({ return id; } 9 Q15.java & Lab_9_and_10 Kinter Assignme. K
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started