Question: Use Dia to complete this assignment Make UML class diagram for our Student class: public class Student { private String firstName; private String lastName; private

Use Dia to complete this assignment Make UML class diagram for our Student class:

public class Student {

private String firstName;

private String lastName;

private int id;

private double gpa;

private int credits;

private static int nextId = 1;

public Student() {

firstName = \"\";

lastName = \"\";

id = nextId;

nextId++;

gpa = 0.0;

credits = 0;

}

public Student(String firstName, String lastName) {

this.firstName = firstName;

this.lastName = lastName;

id = nextId;

nextId++;

gpa = 0.0;

credits = 0;

}

public void addCourse(int creds, String grade) throws IllegalArgumentException {

double gradeGPA;

if (grade.equals(\"A\")) gradeGPA = 4.0;

else if (grade.equals(\"A-\")) gradeGPA = 3.7;

else if (grade.equals(\"B+\")) gradeGPA = 3.3;

else if (grade.equals(\"B\")) gradeGPA = 3.0;

else if (grade.equals(\"B-\")) gradeGPA = 2.7;

else if (grade.equals(\"C+\")) gradeGPA = 2.3;

else if (grade.equals(\"C\")) gradeGPA = 2.0;

else if (grade.equals(\"C-\")) gradeGPA = 1.7;

else if (grade.equals(\"D+\")) gradeGPA = 1.3;

else if (grade.equals(\"D\")) gradeGPA = 1.0;

else if (grade.equals(\"F\")) gradeGPA = 0.0;

else throw new IllegalArgumentException();

gpa = ((gpa * credits) + (gradeGPA * creds)) / (credits + creds);

if (gradeGPA > 0) {

credits += creds;

}

}

public void report() {

System.out.println(firstName + \", \" + lastName + \"\\t\" + id + \"\\t\"

+ String.format(\"%.2f\", gpa) + \"\\t\" + credits);

}

public boolean canGraduate() {

return (credits >= 120) && (gpa >= 2.0);

}

public String getYear() {

if (credits

else if (credits

else if (credits

else return \"Senior\";

}

}

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 Programming Questions!