Question: Main.java: package com.company; import java.util.*; public class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System. in ); String fn =

 Main.java: package com.company; import java.util.*; public class Main { public static

Main.java:

package com.company; import java.util.*; public class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); String fn = stdin.next(); String ln = stdin.next(); double gpa = stdin.nextDouble(); int credits = stdin.nextInt(); Student student1 = new Student(fn, ln, gpa, credits); Student student2 = new Student(); student2.setFirstName("Joe"); student2.setLastName("Jones"); System.out.println("student1 = " + student1.getLastName() + ", " + student1.getFirstName() + " GPA = " + student1.getGPA() + " credits = " + student1.getCreditsEarned()); System.out.println("student2 = " + student2.getLastName() + ", " + student2.getFirstName() + " GPA = " + student2.getGPA() + " credits = " + student2.getCreditsEarned()); System.out.println(); System.out.println("How many students are attending UMW?"); int enrollment = stdin.nextInt(); ArrayList UMWStudents = new ArrayList(enrollment); UMWStudents.add(student1); for (int count = 0; count out.println("student = " + UMWStudents.get(count).getLastName() + ", " + UMWStudents.get(count).getFirstName() + " GPA = " + UMWStudents.get(count).getGPA() + " credits = " + UMWStudents.get(count).getCreditsEarned()); } } } 

Student.java:

package com.company; public class Student { protected String firstName; public String lastName; protected double GPA; protected int creditsEarned; public Student() { GPA = 0.0; creditsEarned = 0; } public Student (String first, String last, double gpa, int credits) { firstName = first; lastName = last; GPA = gpa; creditsEarned = credits; } public void setFirstName(String firstName) { this.firstName = firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public void setGPA (double GPA) { this.GPA = GPA; } public void setCreditsEarned (int creditsEarned) { this.creditsEarned = creditsEarned; } public String getLastName() { return lastName; } public String getFirstName() { return firstName; } public double getGPA() { return GPA; } public int getCreditsEarned() { return creditsEarned; } } 

Adding on Add some additional methods to your main program to gain additional practice in using the ArrayList. Create a method that asks for a last name. Print a record of every student whose last name includes the specified character String. (Example: search for "Sm" would print students with both the last names Smith and Smuckers) Create a method that finds the student with the highest GPA and prints his/her name. If multiple students are tied for the highest GPA, print all students with the high value Adding on Add some additional methods to your main program to gain additional practice in using the ArrayList. Create a method that asks for a last name. Print a record of every student whose last name includes the specified character String. (Example: search for "Sm" would print students with both the last names Smith and Smuckers) Create a method that finds the student with the highest GPA and prints his/her name. If multiple students are tied for the highest GPA, print all students with the high value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!