Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Draw a of the UML class diagram and its relationship package edu.education; public class InvalidGPAException extends Exception { public InvalidGPAException(String s) { super(s); } }

Draw a of the UML class diagram and its relationship

package edu.education;

public class InvalidGPAException extends Exception {

public InvalidGPAException(String s) {

super(s); }

}

package edu.education;

import java.util.ArrayList;

public class Student extends Person {

private double GPA; private static int counter; private ArrayList teachers = new ArrayList<>();

public Student(String firstName, String lastNam, String phoneNumber, String email, double GPA) throws InvalidGPAException {

super(firstName, lastNam, phoneNumber, email); this.setID(++counter); setGPA(GPA);

}

public double getGPA() { return GPA; }

public void setGPA(double gPA) throws InvalidGPAException {

if (!(gPA >= 0.0 && gPA <= 4.0)) { throw new InvalidGPAException("Invalid student GPA. A valid GPA value should be in the 0.0 to 4.0 range!"); } else { GPA = gPA; } }

public void addTeacher(Teacher teacher) { teachers.add(teacher); }

public void displayStudentInfo() {

System.out.println("Student ID: " + this.getID() + "\tStudent name: " + getFirstName() + " " + getLastName());

System.out.printf("%n %15s %15s %15s %20s %17s %23s %n", "Teacher ID", "First name", "Last name", "Phone number", "Email", "Salary"); System.out.println( " __________________________________________________________________________________________________________________________ "); for (Teacher t : teachers) { System.out.printf("%15d %15s %15s %20s %23s %18.2f %n", t.getID(), t.getFirstName(), t.getLastName(), t.getPhoneNumber(), t.getEmail(), t.getSalary()); }

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions

Question

17. Give three synonyms for variation (variability).

Answered: 1 week ago

Question

=+4. How have regulators helped you within the last three years?

Answered: 1 week ago

Question

Write formal proposal requests.

Answered: 1 week ago

Question

Write an effective news release.

Answered: 1 week ago

Question

Identify the different types of proposals.

Answered: 1 week ago