Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you write a test plan table and UML diagram for the program below import java.util.ArrayList; class Student { private String name; private int credits;
Can you write a test plan table and UML diagram for the program below
import java.util.ArrayList;
class Student
private String name;
private int credits;
private int Qpoints;
private static double gpaThreshold; Static field for GPA threshold
public StudentString name, int credits, int Qpoints
this.name name;
this.credits credits;
this.Qpoints Qpoints;
public double gpa
if credits
return ;
return double Qpoints credits;
public boolean eligibleForHonorSociety
return gpa gpaThreshold;
public String toString
return "Name: name GPA: gpa;
public static double getGpaThreshold
return gpaThreshold;
public static void setGpaThresholddouble threshold
gpaThreshold threshold;
class Undergraduate extends Student
private String year;
public UndergraduateString name, int credits, int Qpoints, String year
supername credits, Qpoints;
this.year year;
@Override
public boolean eligibleForHonorSociety
return super.eligibleForHonorSociety && yearequalsJunior year.equalsSenior;
@Override
public String toString
return super.toString Year: year;
class Graduate extends Student
private String degreeSought;
public GraduateString name, int credits, int Qpoints, String degreeSought
supername credits, Qpoints;
this.degreeSought degreeSought;
@Override
public boolean eligibleForHonorSociety
return super.eligibleForHonorSociety && degreeSought.equalsMasters;
@Override
public String toString
return super.toString Degree Sought: degreeSought;
public class Project
public static void mainString args
ArrayList students new ArrayList;
double totalGPA ;
Read student information from a text file
Assuming the text file is properly formatted and named "students.txt
For demonstration purposes, manually adding students
students.addnew UndergraduateBrown William", "Junior";
students.addnew GraduateJohnson Mary", "Masters";
students.addnew UndergraduateJones Sally", "Sophomore";
Calculate total GPA and create Student objects
for Student student : students
totalGPA student.gpa;
Calculate average GPA
double averageGPA students.isEmpty : totalGPA students.size;
Set GPA threshold for honor society membership
Student.setGpaThresholdaverageGPA ;
System.out.printlnGPA Threshold: Student.getGpaThreshold;
Display eligible students
System.out.printlnEligible Students:";
for Student student : students
if studenteligibleForHonorSociety
System.out.printlnstudent;
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