Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need a UML diagram for this application and comment lines written into the code that explain what is happening at each line. Course Registration
I need a UML diagram for this application and comment lines written into the code that explain what is happening at each line.
Course Registration System
Client.java
import javax.swing.JOptionPane;
import java.util.ArrayList;
public class Client
public static void mainString args
ArrayList students new ArrayList;
ArrayList courses new ArrayList;
ArrayList teachers new ArrayList;
teachers.addnew TeacherJohn Doe";
teachers.addnew TeacherJane Smith";
courses.addnew CourseMath teachers.get;
courses.addnew CourseScience teachers.get;
while true
String name JOptionPane.showInputDialogEnter student name:";
if name null name.isEmpty break;
Student student new Studentname;
students.addstudent;
String courseOptions new Stringcoursessize;
for int i ; i courses.size; i
courseOptionsi courses.getigetCourseName;
String courseName String JOptionPane.showInputDialognull "Select course:",
"Course Selection", JOptionPane.QUESTIONMESSAGE, null, courseOptions, courseOptions;
for Course course : courses
if coursegetCourseNameequalscourseName
student.enrollCoursecourse;
break;
JOptionPane.showMessageDialognull student.toString;
int continueOption JOptionPane.showConfirmDialognullDo you want to continue?";
if continueOption JOptionPane.YESOPTION break;
Student.java:
import java.util.ArrayList;
public class Student
private String name;
private int studentID;
private ArrayList enrolledCourses;
public static int studentCount ;
public StudentString name
this.name name;
this.studentID studentCount;
this.enrolledCourses new ArrayList;
public void enrollCourseCourse course
enrolledCourses.addcourse;
public String getName
return name;
public void setNameString name
this.name name;
@Override
public String toString
return "Student ID: studentID
Name: name
Enrolled Courses: enrolledCourses;
Course.java:
public class Course
private String courseName;
private int courseID;
private Teacher teacher;
private static int courseCount ;
public CourseString courseName, Teacher teacher
this.courseName courseName;
this.teacher teacher;
this.courseID courseCount;
public String getCourseName
return courseName;
public void setCourseNameString courseName
this.courseName courseName;
@Override
public String toString
return "Course ID: courseID
Course Name: courseName
Teacher: teacher;
Teacher.java:
public class Teacher
private String name;
private int teacherID;
private static int teacherCount ;
public TeacherString name
this.name name;
this.teacherID teacherCount;
public String getName
return name;
public void setNameString name
this.name name;
@Override
public String toString
return "Teacher ID: teacherID
Name: name;
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