The UML diagram is as follows: Student 0 .. has a 1 Faculty Advisor Requirements Task 1: Implementing student.java with mutators, accessors and toString methods with validation. Task 2: Implementing Faculty Advisor.java with mutators, accessors and toString methods with validation. Task 3: Implementing studentImpl.java

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.5: A Closer Look: Uml Class And Object Diagrams
Problem 6E
icon
Related questions
Question

Please answer JAVA OOP problem below:

You are working at a university that tracks students. Each student is identified by their name 
and faculty advisor. Each faculty advisor is identified by their name, department, and 
maximum number of students they can advise.

Using solid OO design principles, create a modular program that implements all the classes 
for the problem and also creates an implementation class that gathers user input 
for one student and then prints out the information gathered by creating the appropriate data 
definition and implementation classes. All data must be validated. 

 

I have given the code so far:

Implementation:

import javax.swing.JOptionPane;

public class Implementation {
    public static void main(String[] args) {
        FacultyAdvisor facultyAdvisor = new FacultyAdvisor("Sharmin Sultana", "IT", 30);
        Student student = new Student("John", facultyAdvisor);
        JOptionPane.showMessageDialog(null, student.toString());
    }
}
 
Student:
public class Student{
    String name;
    FacultyAdvisor facultyAdvisor;

    //Define constructor and use setter method so that your inputs are validated
    public Student(String name){
        this.name = name;
    }

    //getter and setter methods
    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    //toString() method
    public String toString(){
        return "Student Name: " + this.getName();
    }
}
 
FacultyAdvisor:
public class FacultyAdvisor {
    String name;
    String department;
    int MAX_NUM_STUDENTS = 30;

    public FacultyAdvisor(String name, String department){
        this.name = name;
        this.department = department;
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public String getDepartment(){
        return department;
    }

    public void setDepartment(String department){
        this.department = department;
    }

    public String toString(){
        return "has advisorAdvisor Name: " + this.getName() + "Department: " + this.getDepartment() + "Maximum number of Students: " + MAX_NUM_STUDENTS;
    }
}
The UML diagram is as follows:
Student
0 ..
has a
1
Faculty
Advisor
Transcribed Image Text:The UML diagram is as follows: Student 0 .. has a 1 Faculty Advisor
Requirements
Task 1: Implementing student.java with mutators, accessors and toString
methods with validation.
Task 2: Implementing Faculty Advisor.java with mutators, accessors and
toString methods with validation.
Task 3: Implementing studentImpl.java
Transcribed Image Text:Requirements Task 1: Implementing student.java with mutators, accessors and toString methods with validation. Task 2: Implementing Faculty Advisor.java with mutators, accessors and toString methods with validation. Task 3: Implementing studentImpl.java
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781285867168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning