Question: Given the following two programs, write the output of the StudentApp class. Put your answers in the answer area. // Class representing a student
Given the following two programs, write the output of the StudentApp class. Put your answers in the answer area. // Class representing a student public class Student { private String first; private String last; private double gpa; // Student class constructor } public Student(String first, String last, double gpa) { } } // first name // last name // grade point average public double getGPA() { this.first = first; // first name this.last = last; // last name this.gpagpa; // grade point average return gpa; } public String getLast() { return last; } // Returns a String representation of the Student object public String toString() { return first + " " + last + " GPA: " + gpa; public class StudentApp { public static void main(String args[]) { ArrayList deanList = new ArrayList (); // Example students for testing deanList.add(new Student("Nancy", "Nguyen", 3.5)); deanList.add(new Student("Daniel", "Stern", 2.0)); deanList.add(new Student("Sonya", "King", 3.9)); for (Student student: deanList) { } //equivalent to student.toString(); System.out.println(student);
Step by Step Solution
3.32 Rating (146 Votes )
There are 3 Steps involved in it
import javautilArrayList Class representing a student public class Student private Strin... View full answer
Get step-by-step solutions from verified subject matter experts
