Java Coursework2.0
Java Coursework2.0
I confirm that I understand my coursework needs to be submitted online via Google Classroom under
the
relevant module page before the deadline in order for my assignment to be accepted and marked.
I am fully aware that late submissions will be treated as non-submission and a mark of zero
will be awarded.
Table of Contents
CS4001NT Java Programming .................................................................................. 1
5. Testing ............................................................................................................... 22
5.2.a...................................................................................................................... 23
5.2.b...................................................................................................................... 24
5.2.c. ..................................................................................................................... 25
5.2.d...................................................................................................................... 26
5.3.a.1................................................................................................................... 27
5.3.a.2................................................................................................................... 29
5.3.b.1................................................................................................................... 30
5.3.b.2................................................................................................................... 31
5.3.c ...................................................................................................................... 32
6.Errors .................................................................................................................... 34
6.1. Syntax Errors ................................................................................................. 34
7. Conclusion ......................................................................................................... 38
8. References ........................................................................................................ 39
9. Appendix ............................................................................................................ 40
Table of Figure
Figure 1: Class Diagram............................................................................................. 4
Figure 2: Testing the program using command prompt ............................................ 22
Figure 3: Initializing the value of parameters passed on the constructor of the
AcademicCourse class ............................................................................................. 23
Figure 4: Initializing the value of the parameters passed on the constructor of the
NonAcademicCourse class ...................................................................................... 24
Figure 5: Initializing the value of the parameters passed on the constructor of the
AcademicCourse class ............................................................................................. 26
Figure 6: Initializing the value of the parameters passed on the constructor of the
NonAcademicCourse ............................................................................................... 27
Figure 7: Testing figure to add the duplicate courseID of Academic Course ............ 28
Figure 8: To add courseID of Non-Academic Course ............................................... 29
Figure 9: To register the already register course in Academic Course ..................... 31
Figure 10: To register the already register course in Non-Academic Course ........... 32
Figure 11: Detecting the Error .................................................................................. 34
Figure 12: Fixing the error ........................................................................................ 34
Figure 13: Detecting the semantic error ................................................................... 35
Figure 14: fixing the error ......................................................................................... 35
Figure 16: detecting error ......................................................................................... 36
Figure 17: fixing the error ......................................................................................... 37
Figure 18: fixing the error ......................................................................................... 37
Table of Tables
Table 1: To test whether the program can be compiled and run the program in cmd
................................................................................................................................. 22
Table 2: Testing table to add course for AcademicCourse ....................................... 23
Table 3: Testing table to add course for NonAcademicCourse ................................ 24
Table 4: Testing table for registering the AcademicCourse: ..................................... 25
Table 5: Testing table for registering the NonAcademicCourse ............................... 26
Table 6: To test the duplicate courseID of AcademicCourse.................................... 27
Table 7: Testing table to add duplicate courseID of Non-Academic Course ............ 29
Table 8 Testing table to register the already registered course in Academic Course
................................................................................................................................. 30
Table 9: Testing table to register the already register course in Non-Academic Course
................................................................................................................................. 31
Table 10 ................................................................................................................... 32
1. Introduction of Java Programming
As we all know java is a programming language which was introduced by James
Gosling from sun Microsystem in 1991. Its target is to write a program once and then
run this program on multiple operating system. There are many popular programming
languages in this world. Among them java is one of the high-level programming
languages. Java is defined as the object-oriented programming language that consists
of data and code, data in the form of field (objects known as attributes or properties)
and code in the form of procedures (objects known as methods). Java Virtual Machine
(JVM), Java Development Kit (JDK), Java Runtime Environment (JRE) are the
component of java programming language.
• Java Virtual Machine (JVM): A Java virtual machine (JVM) is a virtual machine
that empowers a computer to dash Java programs as well as programs
composed in former languages that are also compiled to Java bytecode. Java's
stand independence comprises mainly of its Java Virtual Machine (JVM) . JVM
makes this achievable because it is alert of the specific order lengths and
former particularities of the stage.
• Java Runtime Environment (JRE): The Java Runtime Environment is a
programming layer that runs at top of a computer’s functioning technique
programming and gives the class libraries and other means that a exact Java
program needs to run. The JRE is one of three unified components for creating
and running Java programs (Education, 2020).
• Java Development Kit (JDK): The Java Development Kit (JDK) is a
programming development situation used for budding Java applications and
applets. It includes the Java Runtime Situation (JRE), an interpreter/loader
1|Page
SUMAN BHANDARI
(java), a compiler (javac), an archiver (jar), a documents producer (javadoc)
and last gear needed in Java progress (techopedia, 2020).
• Object Oriented
• High Performance
• Dynamic
• Simple
• Platform Independent
• Secure
• Portable
• Interpreted
2|Page
SUMAN BHANDARI
elements such as buttons, labels, and windows that let the user to connected by an
application. The use of a graphical user interface (GUI) is critical for creating user
interfaces for Java programs. According to the query, the GUI which I have to build for
this project have to include the components of Java Swing or AWT. For this project, I
get to make a ING_World class which stores the array list (not an array) of the type
Path to hold the AcademicCourse and NonAcademicCourse. In the made GUI, there
must be the text field. Add course for Academic Course. Add course for Non-Academic
Course, Register Academic Course, Register Non-Academic Course, Remove Non-
Academic Course, Cancel, Display, clear these buttons is used in this project.
3|Page
SUMAN BHANDARI
2. Class Diagram
A class diagram is a diagram used in scheming and modeling software to explain
classes and their relations. Class diagrams allow us to sculpt software in a high level
of construct and devoid of having to look at the source code. Classes in a class
diagram compare with classes in the source code. Every attribute is written on the
separate line.
4|Page
SUMAN BHANDARI
2.1. INGWorld Class Diagram
INGWorld
-JFrame:
addAcf, registerAcf, displayAcf, addNAcCF, registerNAcCF, removeNonAcCF.
-JLabel:
addActitLabel, registerlabelAcademicTitle, displaylavelAcademicTitle,
addIdAcademiccourse,
addlabelAcademicCourseName, addlabelAcademicDuration,
addlabelAcademicLevel, addAcademicCreditLabel,
addAcademicNo_of_AssessmentsLabel, registerlabelCourseID,
registerlabelAcademicCourseLeader,
registerlabelAcademicLecturerName, registerlabelAcademicStartDate,
registerlabelAcademicCompletionDate,
displaylabelcademicCourseID, addNonActitLabel,
registerlabelNonAcademicTitle, removeNonAcademicTitleLabel,
addLabelNonAcademicCourseID, addLabelNonAcademicCourseName,
addLabelNonAcademicDuration,
addLabelNonAcademicPrerequisite, registerLabelNonAcademicCourseID,
registerLabelNonAcademicCourseLeader,
registerLabelNonAcademicInstructorName,
registerLabelNonAcademicStartDate,
registerLabelNonAcademicCompletionDate,
registerLabelNonAcademicExamDate, removeLabelNonAcademicCourseID;
-JTextField:
addAcademicCourseIDTF, addAcademicCourseNameTF,
addAcademicDurationTF, addAcademicLevelTF,
addAcademicCreditTF, addAcademicNo_of_AssessmentsTF,
registerAcademicCourseIDTF,
registerAcademicCourseLeaderTF, registerAcademicLecturerNameTF,
registerAcademicStartDateTF,
5|Page
SUMAN BHANDARI
registerAcademicCompletionDateTF, displayAcademicCourseIDTF,
addNonAcademicCourseIDTF, addNonAcademicCourseNameTF,
addNonAcademicDurationTF,
addNonAcademicPrerequisiteTF, registerNonAcademicCourseIDTF,
registerNonAcademicCourseLeaderTF,
registerNonAcademicInstructorNameTF, registerNonAcademicStartDateTF,
registerNonAcademicCompletionDateTF,
registerNonAcademicExamDateTF, removeNonAcademicCourseIDTF;
-JButton:
addbuttonAC, addbuttonClearAC, addbuttonCancelAC, addbuttonRegisterAC,
registerbuttonAC,
registerclearACButton, registerACDisplayButton, registerACCancelButton,
displayDisplayAButton,
addButtonNAC, addButtonClearNAC, addButtonCancelNAC,
addButtonRegisterNAC, registerButtonRegisterNAC,
registerButtonClearNAC, registerButtonCancelNAC,
registerButtonDisplayNAC, removeButtonRemoveNAC,
removeButtonDisplayNAC;
-JTextArea:
txtAreaDplayAcCourse, txtAreaDplayNonAcCourse;
6|Page
SUMAN BHANDARI
+ actionPerformed (ActionEvent ) void:
addbuttonAC, addbuttonClearAC, addbuttonCancelAC, addbuttonRegisterAC,
registerbuttonAC,
registerclearACButton, registerACDisplayButton, registerACCancelButton,
displayDisplayAButton,
addButtonNAC, addButtonClearNAC, addButtonCancelNAC,
addButtonRegisterNAC, registerButtonRegisterNAC,
registerButtonClearNAC, registerButtonCancelNAC,
registerButtonDisplayNAC, removeButtonRemoveNAC,
removeButtonDisplayNAC;
7|Page
SUMAN BHANDARI
3. Pseudo Code for each method in each class
DO
END DO
DO
END DO
DO
END DO
DO
8|Page
SUMAN BHANDARI
RETURN the value of addAcademicLevelTF
END DO
DO
END DO
DO
END DO
DO
END DO
9|Page
SUMAN BHANDARI
FUNCTION return type “String” getRegisterAcademicCourseLeaderTF ()
DO
END DO
DO
END DO
DO
END DO
DO
10 | P a g e
SUMAN BHANDARI
END DO
DO
END DO
DO
END DO
DO
END DO
DO
11 | P a g e
SUMAN BHANDARI
END DO
DO
END DO
DO
END DO
DO
END DO
DO
END DO
12 | P a g e
SUMAN BHANDARI
FUNCTION return type “String” getRegisterNonAcademicStartDateTF ()
DO
END DO
DO
END DO
DO
END DO
DO
END DO
13 | P a g e
SUMAN BHANDARI
FUNCTION non-return type “void” addAcademicCourse ()
DO
addActitLabel.setForeground(Color.BLACK)
addAcf.add(addActitLabel)
addIdAcademiccourse.setForeground(Color.BLUE)
addIdAcademiccourse.setFont(new
addAcf.add(addAcademicCourseIDTF)
addAcf.add(addIdAcademiccourse)
Name:")
50);
addlabelAcademicCourseName.setFont(new
14 | P a g e
SUMAN BHANDARI
FontUIResource("Monospace", Font.BOLD, 14))
addlabelAcademicCourseName.setForeground(Color.BLUE)
addAcf.add(addAcademicCourseNameTF)
addAcf.add(addlabelAcademicCourseName)
addlabelAcademicDuration.setFont(newFontUIResource("Monospace",
Font.BOLD, 14))
addlabelAcademicDuration.setForeground(Color.BLUE)
addAcf.add(addAcademicDurationTF)
addAcf.add(addlabelAcademicDuration)
addlabelAcademicLevel.setFont(newFontUIResource("Monospace",
Font.BOLD, 14))
addlabelAcademicLevel.setForeground(Color.BLUE)
addAcf.add(addAcademicLevelTF)
15 | P a g e
SUMAN BHANDARI
addAcf.add(addlabelAcademicLevel)
addAcademicNo_of_AssessmentsLabel = new
JLabel("Number_of_Assessments:")
addAcademicNo_of_AssessmentsLabel.setFont(new
a ddAcademicNo_of_AssessmentsLabel.setForeground(Color.BLUE)
addAcf.add(addAcademicNo_of_AssessmentsTF)
addAcf.add(addAcademicNo_of_AssessmentsLabel)
addAcademicCreditLabel.setFont(new FontUIResource("Monospace",
Font.BOLD, 14))
addAcademicCreditLabel.setForeground(Color.BLUE)
addAcf.add(addAcademicCreditTF)
addAcf.add(addAcademicCreditLabel)
addbuttonAC.setFocusable(false)
16 | P a g e
SUMAN BHANDARI
Font.BOLD, 15))
addbuttonAC.setBackground(Color.RED)
addbuttonAC.setOpaque(true)
addbuttonAC.setForeground(Color.WHITE)
Do
IDTF()
getAddAcademicCourseNameTF()
TF()
noofAssessmentsField()
noOfAssessmentsString is equals to “”
DO
17 | P a g e
SUMAN BHANDARI
4. Short Description of Methods
4.1. INGCollege Class
18 | P a g e
SUMAN BHANDARI
• getNonAcademicDurationTF (): This method helps to get the value of
addNonAcademicDurationTF. This method is a return type method.
• getNonAcademicPrerequisiteTF (): This method helps to get the value of
addNonAcademicPrerequisiteTF. This method is a return type method.
• getRegisterNonAcademicCourseIDTF (): This method helps to get the value
of getRegisterNonAcademicCourseIDTF. This method is a return type method.
• getRegisterNonAcademicCourseLeaderTF (): This method helps to get the
value of getRegisterNonAcademicCourse LeaderTF. This method is a return
type method.
• getRegisterNonAcademicInstructorNameTF (): This method helps to get the
value of getRegisterNon AcademicInstructor NameTF. This method is a return
type method.
• getRegisterNonAcademicStartDateTF (): This method helps to get the value
of getRegisterNonAcademicStartDate TF. This method is a return type method.
• getRegisterNonAcademicCompletionDateTF (): This method helps to get
the value of getRegisterNonAcademic CompletionDateTF. This method is a
return type method.
• getRegisterNonAcademicExamDateTF (): This method helps to get the value
of getRegisterNonAcademicExamDateTF. This method is a return type
method.
• getRemoveNonAcademicCourseIDTF (): This method helps to get the value
of getRemoveNonAcademicCourse IDTF. This method is a return type method.
• addAcademicCourse (): This method helps to add all the course of the
Academic Course. This method is a void return type method which means non-
return type method. This method helps to create addAcademicCourseFrame.
The frame contains the different JLabel with their respective textfield like:
1) addAcademicCourseIDTF.
2) addAcademicCourseNameTF
3) addAcademicDurationTF
4) addAcademicLevelTF
5) addAcademicCreditTF
6) addAcademicNo_Of_AssessmentsTF
19 | P a g e
SUMAN BHANDARI
The frame in this method contains 4 buttons. Each button has its own special
function. They are like:
1) addbuttonAC
2) addbuttonClearAC
3) addbuttonCancelAC
4) addbuttonRegisterAC
The frame contains the different JLabel with their respective textfield like:
1) addNonAcademicCourseIDTF
2) addNonAcademicCourseNameTF
3) addNonAcademicDurationTF
4) addNonAcademicPrerequisiteTF
• The frame in this method contains 4 buttons. Each button has its own special
function. They are like:
20 | P a g e
SUMAN BHANDARI
1) addButtonNAC
2) clearButtonNAC
3) registerButtonNAC
4) cancelButtonNAC
21 | P a g e
SUMAN BHANDARI
5. Testing
This is where the report's study section starts. The separate java files in the
coursework are checked using the commands from the question section, and their
inspection tables with different screenshots are shown below:
5.1. Test 1
Table 1: To test whether the program can be compiled and run the program in cmd
-javac INGWorld.java
-java INGWorld
Expected Result GUI must be displayed while compiling and running the
program
Actual Result GUI is displayed.
Conclusion Test successful.
22 | P a g e
SUMAN BHANDARI
5.2. Test 2
5.2.a.
Table 2: Testing table to add course for AcademicCourse
Figure 3: Initializing the value of parameters passed on the constructor of the AcademicCourse class
23 | P a g e
SUMAN BHANDARI
5.2.b.
Table 3: Testing table to add course for NonAcademicCourse
Figure 4: Initializing the value of the parameters passed on the constructor of the NonAcademicCourse class
24 | P a g e
SUMAN BHANDARI
5.2.c.
Table 4: Testing table for registering the AcademicCourse:
25 | P a g e
SUMAN BHANDARI
Figure 5: Initializing the value of the parameters passed on the constructor of the AcademicCourse class
5.2.d.
Table 5: Testing table for registering the NonAcademicCourse
26 | P a g e
SUMAN BHANDARI
Actual Result The course of NonAcademicCourse is included presenting/displaying
the dialog box.
Conclusion Test successful.
Figure 6: Initializing the value of the parameters passed on the constructor of the NonAcademicCourse
5.3. Test 3
5.3.a.1
Table 6: To test the duplicate courseID of AcademicCourse
27 | P a g e
SUMAN BHANDARI
Course ID:”ST16460M”
Course Name: Java
Duration= 6
level=T025
Credit: A
No_of_Assessments: 14
28 | P a g e
SUMAN BHANDARI
5.3.a.2.
Table 7: Testing table to add duplicate courseID of Non-Academic Course
29 | P a g e
SUMAN BHANDARI
5.3.b.1.
Table 8 Testing table to register the already registered course in Academic Course
30 | P a g e
SUMAN BHANDARI
Figure 9: To register the already register course in Academic Course
5.3.b.2.
Table 9: Testing table to register the already register course in Non-Academic Course
31 | P a g e
SUMAN BHANDARI
Figure 10: To register the already register course in Non-Academic Course
5.3.c
Table 10
32 | P a g e
SUMAN BHANDARI
Subsequent values are entered on the respective textfields for removing the
NonAcademicCourse in the removeNonAcademicCourseFrame:
Course ID:”ST16460M”
33 | P a g e
SUMAN BHANDARI
6.Errors
6.1. Syntax Errors
Java syntax errors consign to mistakes made by a programmer in implementing the
syntax of the Java programming language which doesn't cover mistakes in logic of the
program itself. Similar all other programming languages, java has its own syntax. For
example, one rule of Java syntax is that all commands must end with a (;) called
semicolon. Java syntax is extremely easier than the syntax of English or any other
"natural" language but it is also much stricter (demand73164, 2021). I have given
example of syntax error and correcting the error which is shown in figure below.
34 | P a g e
SUMAN BHANDARI
mismatched is another compile time error. The semantic error can arises using the
wrong adjustable or via wrong operator or doing operation in wrong command
(Javapoint, 2021). I have given example of Semantic error and correcting the errors
which is shown in figure below.
35 | P a g e
SUMAN BHANDARI
Figure 15: detecting error
36 | P a g e
SUMAN BHANDARI
Figure 16: fixing the error
37 | P a g e
SUMAN BHANDARI
7. Conclusion
Java programming was completely new for me. I have no any idea about this subject.
At the beginning of this subject, I was quite frightened and nervous because I haven’t
seen any terms which I have seen in this module. Because of the module teachers I
started to overcome with the problems which I have faced. After I started this module,
I started to focus more on the small terms of this module. While coping with the
problems, many difficulties and error comes while doing programming but I didn’t give
up and tried hard with all my abilities. I started to take help from the senior brothers
and sisters as well. When I solve the problems, I feel like I have acquired new things
which makes me very happy and excited to solve the problems. As I have listened
about the coursework since the beginning of my college. programming coursework is
fully new for me. But I was very excited to do the coursework. However, I have faced
lots of difficulties and problems in the questions. For me, each and every question on
this coursework is equally important and more challenging to me. As per the time given
by the college to submit this coursework is much more challenging.
The project is regarding creating a GUI by means of Java Swing or AWT. Concurring
to this project, we have to design a GUI. For the GUI, we have to design an ING_World
class which stores an array list but not an array of type Path to clasp the
AcademicCourse and NonAcademicCourse. As tackling this project, many issues and
challenges emerges. I take the help from the module instructors, elder brothers and
sisters and friends as well. Apart from classes, I erudite the concept of making a GUI
from the online lecture classes. But, the new format of knowledge makes a difference
me to deal with the trouble more realistically or virtually than hypothetically.
I have study hard and overcome all the problems of this project which feels good to
me. I have focus terms and condition of this project and study on it. This way I have
complete my project with the help of senior brother, sister, my classmate and module
teacher so, I would like thank all of them.
38 | P a g e
SUMAN BHANDARI
8. References
demand73164, 2021. What Is a Syntax Error in Java?. [Online]
Available at: https://www.techwalla.com/articles/what-is-a-syntax-error-in-java
[Accessed 10 August 2021].
39 | P a g e
SUMAN BHANDARI
9. Appendix
/**
*/
import java.awt.Color;
import java.awt.Font;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
40 | P a g e
SUMAN BHANDARI
public class INGWorld {
// Acf=AcademicCourseFrame
// NonAcademic frame
addlabelAcademicCourseName, addlabelAcademicDuration,
addlabelAcademicLevel, addAcademicCreditLabel,
addAcademicNo_of_AssessmentsLabel, registerlabelCourseID,
registerlabelAcademicCourseLeader,
registerlabelAcademicLecturerName, registerlabelAcademicStartDate,
registerlabelAcademicCompletionDate,
displaylabelcademicCourseID,
// NonAcademic label
addNonActitLabel, registerlabelNonAcademicTitle,
removeNonAcademicTitleLabel,
addLabelNonAcademicCourseID, addLabelNonAcademicCourseName,
addLabelNonAcademicDuration,
41 | P a g e
SUMAN BHANDARI
addLabelNonAcademicPrerequisite, registerLabelNonAcademicCourseID,
registerLabelNonAcademicCourseLeader,
registerLabelNonAcademicInstructorName,
registerLabelNonAcademicStartDate,
registerLabelNonAcademicCompletionDate,
registerLabelNonAcademicExamDate, removeLabelNonAcademicCourseID;
addAcademicCreditTF, addAcademicNo_of_AssessmentsTF,
registerAcademicCourseIDTF,
registerAcademicCourseLeaderTF, registerAcademicLecturerNameTF,
registerAcademicStartDateTF,
registerAcademicCompletionDateTF, displayAcademicCourseIDTF,
// NonAcademic textfield
addNonAcademicCourseIDTF, addNonAcademicCourseNameTF,
addNonAcademicDurationTF,
addNonAcademicPrerequisiteTF, registerNonAcademicCourseIDTF,
registerNonAcademicCourseLeaderTF,
registerNonAcademicInstructorNameTF, registerNonAcademicStartDateTF,
registerNonAcademicCompletionDateTF,
registerNonAcademicExamDateTF, removeNonAcademicCourseIDTF;
42 | P a g e
SUMAN BHANDARI
registerclearACButton, registerACDisplayButton, registerACCancelButton,
displayDisplayAButton,
// NonAcademic Button
registerButtonClearNAC, registerButtonCancelNAC,
registerButtonDisplayNAC, removeButtonRemoveNAC,
removeButtonDisplayNAC;
// Academic Course
return addAcademicCourseIDTF.getText();
return addAcademicCourseNameTF.getText();
return addAcademicDurationTF.getText();
43 | P a g e
SUMAN BHANDARI
public String getAddAcademicLevelTF() {
return addAcademicLevelTF.getText();
return addAcademicCreditTF.getText();
return addAcademicNo_of_AssessmentsTF.getText();
return registerAcademicCourseIDTF.getText();
return registerAcademicCourseLeaderTF.getText();
return registerAcademicLecturerNameTF.getText();
44 | P a g e
SUMAN BHANDARI
public String getRegisterAcademicStartDateTF() {
return registerAcademicStartDateTF.getText();
return registerAcademicCompletionDateTF.getText();
return displayAcademicCourseIDTF.getText();
return addNonAcademicCourseIDTF.getText();
return addNonAcademicCourseNameTF.getText();
return addNonAcademicDurationTF.getText();
45 | P a g e
SUMAN BHANDARI
public String getAddNonAcademicPrerequisiteTF() {
return addNonAcademicPrerequisiteTF.getText();
return registerNonAcademicCourseIDTF.getText();
return registerNonAcademicCourseLeaderTF.getText();
return registerNonAcademicInstructorNameTF.getText();
return registerNonAcademicStartDateTF.getText();
return registerNonAcademicCompletionDateTF.getText();
46 | P a g e
SUMAN BHANDARI
public String getRegisterNonAcademicExamDateTF() {
return registerNonAcademicExamDateTF.getText();
return removeNonAcademicCourseIDTF.getText();
addActitLabel.setForeground(Color.BLACK);
addAcf.add(addActitLabel);
addIdAcademiccourse.setForeground(Color.BLUE);
addIdAcademiccourse.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
47 | P a g e
SUMAN BHANDARI
addAcademicCourseIDTF.setBounds(120, 86, 200, 25);
addAcf.add(addAcademicCourseIDTF);
addAcf.add(addIdAcademiccourse);
addlabelAcademicCourseName.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
addlabelAcademicCourseName.setForeground(Color.BLUE);
addAcf.add(addAcademicCourseNameTF);
addAcf.add(addlabelAcademicCourseName);
addlabelAcademicDuration.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
addlabelAcademicDuration.setForeground(Color.BLUE);
addAcf.add(addAcademicDurationTF);
addAcf.add(addlabelAcademicDuration);
48 | P a g e
SUMAN BHANDARI
addlabelAcademicLevel.setBounds(395, 130, 100, 50);
addlabelAcademicLevel.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
addlabelAcademicLevel.setForeground(Color.BLUE);
addAcf.add(addAcademicLevelTF);
addAcf.add(addlabelAcademicLevel);
addAcademicNo_of_AssessmentsLabel = new
JLabel("Number_of_Assessments:");
addAcademicNo_of_AssessmentsLabel.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
addAcademicNo_of_AssessmentsLabel.setForeground(Color.BLUE);
addAcf.add(addAcademicNo_of_AssessmentsTF);
addAcf.add(addAcademicNo_of_AssessmentsLabel);
addAcademicCreditLabel.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
addAcademicCreditLabel.setForeground(Color.BLUE);
49 | P a g e
SUMAN BHANDARI
addAcademicCreditTF = new JTextField();
addAcf.add(addAcademicCreditTF);
addAcf.add(addAcademicCreditLabel);
addbuttonAC.setFocusable(false);
addbuttonAC.setBackground(Color.RED);
addbuttonAC.setOpaque(true);
addbuttonAC.setForeground(Color.WHITE);
addbuttonAC.addActionListener(new ActionListener() {
// System.out.println("Hellow");
String noOfAssessmentsStr =
getAddAcademicNo_Of_AssessmentsTF();
50 | P a g e
SUMAN BHANDARI
int duration, noOfAssessments;
|| credit.equals("") || noOfAssessmentsStr.equals("")) {
return;
} else {
if (listing.isEmpty() == true) {
flag = true;
} else {
if (aC.getCourseId().equalsIgnoreCase(courseID)) {
return;
} else {
flag = true;
51 | P a g e
SUMAN BHANDARI
try {
duration = Integer.parseInt(durationStr);
return;
try {
noOfAssessments = Integer.parseInt(noOfAssessmentsStr);
JOptionPane.showMessageDialog(null,
return;
if (flag == true) {
noOfAssessments));
JOptionPane.showMessageDialog(null,
52 | P a g e
SUMAN BHANDARI
JOptionPane.INFORMATION_MESSAGE);
return;
});
addAcf.add(addbuttonAC);
addbuttonRegisterAC.setFocusable(false);
addbuttonRegisterAC.setForeground(Color.WHITE);
addbuttonRegisterAC.setBackground(Color.RED);
addbuttonRegisterAC.setOpaque(true);
addbuttonRegisterAC.addActionListener(new ActionListener() {
addAcf.dispose();
registerAcademicCourse();
});
addAcf.add(addbuttonRegisterAC);
53 | P a g e
SUMAN BHANDARI
addbuttonClearAC = new JButton("Clear");
addbuttonClearAC.setFocusable(false);
addbuttonClearAC.setForeground(Color.WHITE);
addbuttonClearAC.setBackground(Color.RED);
addbuttonClearAC.setOpaque(true);
addbuttonClearAC.addActionListener(new ActionListener() {
addAcademicCourseIDTF.setText("");
addAcademicCourseNameTF.setText("");
addAcademicDurationTF.setText("");
addAcademicLevelTF.setText("");
addAcademicCreditTF.setText("");
addAcademicNo_of_AssessmentsTF.setText("");
});
addAcf.add(addbuttonClearAC);
addbuttonCancelAC.setFocusable(false);
addbuttonCancelAC.setForeground(Color.WHITE);
54 | P a g e
SUMAN BHANDARI
addbuttonCancelAC.setBackground(Color.RED);
addbuttonCancelAC.setOpaque(true);
addbuttonCancelAC.addActionListener(new ActionListener() {
System.exit(0);
});
addAcf.add(addbuttonCancelAC);
addAcf.setSize(700, 520);
addAcf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addAcf.setLocationRelativeTo(null);
addAcf.setLayout(null);
addAcf.setResizable(false);
addAcf.getContentPane().setBackground(Color.PINK);
addAcf.setVisible(true);
55 | P a g e
SUMAN BHANDARI
registerlabelAcademicTitle.setForeground(Color.BLACK);
registerAcf.add(registerlabelAcademicTitle);
registerlabelCourseID.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
registerlabelCourseID.setForeground(Color.BLUE);
registerAcademicCourseIDTF.setBorder(BorderFactory.createLineBorder(Color.light
Gray, 2));
registerAcf.add(registerAcademicCourseIDTF);
registerAcf.add(registerlabelCourseID);
registerlabelAcademicCourseLeader.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
registerlabelAcademicCourseLeader.setForeground(Color.BLUE);
registerAcf.add(registerAcademicCourseLeaderTF);
registerAcf.add(registerlabelAcademicCourseLeader);
56 | P a g e
SUMAN BHANDARI
registerlabelAcademicLecturerName = new JLabel("Lecturer Name:");
registerlabelAcademicLecturerName.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
registerlabelAcademicLecturerName.setForeground(Color.BLUE);
registerAcf.add(registerAcademicLecturerNameTF);
registerAcf.add(registerlabelAcademicLecturerName);
registerlabelAcademicStartDate.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
registerlabelAcademicStartDate.setForeground(Color.BLUE);
registerAcf.add(registerAcademicStartDateTF);
registerAcf.add(registerlabelAcademicStartDate);
registerlabelAcademicCompletionDate.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
57 | P a g e
SUMAN BHANDARI
registerlabelAcademicCompletionDate.setForeground(Color.BLUE);
registerAcf.add(registerAcademicCompletionDateTF);
registerAcf.add(registerlabelAcademicCompletionDate);
registerACDisplayButton.setFocusable(false);
registerACDisplayButton.setBackground(Color.RED);
registerACDisplayButton.setOpaque(true);
registerACDisplayButton.setForeground(Color.WHITE);
registerACDisplayButton.addActionListener(new ActionListener() {
registerAcf.dispose();
displayAcademicCourse();
});
registerAcf.add(registerACDisplayButton);
58 | P a g e
SUMAN BHANDARI
registerbuttonAC.setFocusable(false);
registerbuttonAC.setBackground(Color.RED);
registerbuttonAC.setOpaque(true);
registerbuttonAC.setForeground(Color.WHITE);
registerbuttonAC.addActionListener(new ActionListener() {
if (courseID.equals("") || courseLeader.equals("") ||
lecturerName.equals("")
|| startDate.equals("") || completionDate.equals("")) {
2);
return;
} else {
if (listing.isEmpty() == true) {
59 | P a g e
SUMAN BHANDARI
JOptionPane.showMessageDialog(null, "Add the course before the
course register.",
return;
} else {
if (courseRtr.getCourseId().equalsIgnoreCase(courseID)) {
if (aC.getIsRegistered() == true) {
JOptionPane.showMessageDialog(null, "Course is
registered already.",
return;
} else {
return;
} else {
60 | P a g e
SUMAN BHANDARI
flag = true;
if (flag == true) {
"Identification", JOptionPane.WARNING_MESSAGE);
return;
});
registerAcf.add(registerbuttonAC);
registerclearACButton.setFocusable(false);
registerclearACButton.setBackground(Color.RED);
registerclearACButton.setOpaque(true);
registerclearACButton.setForeground(Color.WHITE);
61 | P a g e
SUMAN BHANDARI
registerclearACButton.addActionListener(new ActionListener() {
registerAcademicCourseIDTF.setText("");
registerAcademicCourseLeaderTF.setText("");
registerAcademicLecturerNameTF.setText("");
registerAcademicStartDateTF.setText("");
registerAcademicCompletionDateTF.setText("");
});
registerAcf.add(registerclearACButton);
registerACCancelButton.setFocusable(false);
registerACCancelButton.setBackground(Color.RED);
registerACCancelButton.setOpaque(true);
registerACCancelButton.setForeground(Color.WHITE);
registerACCancelButton.addActionListener(new ActionListener() {
System.exit(0);
62 | P a g e
SUMAN BHANDARI
}
});
registerAcf.add(registerACCancelButton);
registerAcf.setSize(750, 500);
registerAcf.setResizable(false);
registerAcf.setLayout(null);
registerAcf.setLocationRelativeTo(null);
registerAcf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
registerAcf.setVisible(true);
registerAcf.getContentPane().setBackground(Color.PINK);
displaylavelAcademicTitle.setForeground(Color.BLACK);
displayAcf.add(displaylavelAcademicTitle);
63 | P a g e
SUMAN BHANDARI
displaylabelcademicCourseID.setBounds(40, 110, 100, 50);
displaylabelcademicCourseID.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
displaylabelcademicCourseID.setForeground(Color.BLUE);
displayAcf.add(displayAcademicCourseIDTF);
displayAcf.add(displaylabelcademicCourseID);
displayAcf.add(txtAreaDplayAcCourse);
displayDisplayAButton.setFocusable(false);
displayDisplayAButton.setBackground(Color.RED);
displayDisplayAButton.setOpaque(true);
displayDisplayAButton.setForeground(Color.WHITE);
displayDisplayAButton.addActionListener(new ActionListener() {
64 | P a g e
SUMAN BHANDARI
boolean flag = false;
if (listing.isEmpty() == true) {
flag = true;
} else {
if (courseDplay.getCourseId().equalsIgnoreCase(courseID)) {
if (aF.getIsRegistered() == true) {
aF.display();
txtAreaDplayAcCourse.setText("Course ID : " +
getAddAcademicCourseIDTF()
+ getAddAcademicDurationTextField() + "\nLevel :
"
+ getAddAcademicLevelTF() +
"\nNo_Of_Assessments : "
+ getAddAcademicNo_Of_AssessmentsTF());
return;
65 | P a g e
SUMAN BHANDARI
} else {
flag = true;
if (flag == true) {
return;
});
displayAcf.add(displayDisplayAButton);
displayAcf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
displayAcf.setSize(700, 500);
displayAcf.setLocationRelativeTo(null);
displayAcf.setLayout(null);
displayAcf.setResizable(false);
displayAcf.getContentPane().setBackground(Color.PINK);
displayAcf.setVisible(true);
66 | P a g e
SUMAN BHANDARI
}
addNonActitLabel.setForeground(Color.BLACK);
addNAcCF.add(addNonActitLabel);
addLabelNonAcademicCourseID.setForeground(Color.BLUE);
addLabelNonAcademicCourseID.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
addNAcCF.add(addNonAcademicCourseIDTF);
addNAcCF.add(addLabelNonAcademicCourseID);
67 | P a g e
SUMAN BHANDARI
addLabelNonAcademicCourseName.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
addLabelNonAcademicCourseName.setForeground(Color.BLUE);
addNAcCF.add(addNonAcademicCourseNameTF);
addNAcCF.add(addLabelNonAcademicCourseName);
addLabelNonAcademicDuration.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));
addLabelNonAcademicDuration.setForeground(Color.BLUE);
addNAcCF.add(addNonAcademicDurationTF);
addNAcCF.add(addLabelNonAcademicDuration);
addLabelNonAcademicPrerequisite.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
addLabelNonAcademicPrerequisite.setForeground(Color.BLUE);
68 | P a g e
SUMAN BHANDARI
addNAcCF.add(addNonAcademicPrerequisiteTF);
addNAcCF.add(addLabelNonAcademicPrerequisite);
addButtonNAC.setFocusable(false);
addButtonNAC.setBackground(Color.RED);
addButtonNAC.setOpaque(true);
addButtonNAC.setForeground(Color.WHITE);
addButtonNAC.addActionListener(new ActionListener() {
int duration;
|| prerequisite.equals("")) {
69 | P a g e
SUMAN BHANDARI
JOptionPane.showMessageDialog(null, "Empty Textfield. fill up all the
fields.",
return;
} else {
if (listing.isEmpty() == true) {
flag = true;
} else {
if (course.getCourseId().equalsIgnoreCase(courseID)) {
return;
} else {
flag = true;
try {
duration = Integer.parseInt(durationStr);
70 | P a g e
SUMAN BHANDARI
"Numeric Error", JOptionPane.ERROR_MESSAGE);
return;
if (flag == true) {
JOptionPane.showMessageDialog(null,
JOptionPane.INFORMATION_MESSAGE);
return;
});
addNAcCF.add(addButtonNAC);
addButtonRegisterNAC.setFocusable(false);
addButtonRegisterNAC.setForeground(Color.WHITE);
addButtonRegisterNAC.setBackground(Color.RED);
addButtonRegisterNAC.setOpaque(true);
71 | P a g e
SUMAN BHANDARI
addButtonRegisterNAC.addActionListener(new ActionListener() {
addNAcCF.dispose();
registerNonAcademicCourse();
});
addNAcCF.add(addButtonRegisterNAC);
addButtonClearNAC.setFocusable(false);
addButtonClearNAC.setForeground(Color.WHITE);
addButtonClearNAC.setBackground(Color.RED);
addButtonClearNAC.setOpaque(true);
addButtonClearNAC.addActionListener(new ActionListener() {
addNonAcademicCourseIDTF.setText("");
addNonAcademicCourseNameTF.setText("");
addNonAcademicDurationTF.setText("");
addNonAcademicPrerequisiteTF.setText("");
72 | P a g e
SUMAN BHANDARI
});
addNAcCF.add(addButtonClearNAC);
addButtonCancelNAC.setFocusable(false);
addButtonCancelNAC.setForeground(Color.WHITE);
addButtonCancelNAC.setBackground(Color.RED);
addButtonCancelNAC.setOpaque(true);
addButtonCancelNAC.addActionListener(new ActionListener() {
System.exit(0);
});
addNAcCF.add(addButtonCancelNAC);
addNAcCF.setSize(700, 520);
addNAcCF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addNAcCF.setLocationRelativeTo(null);
addNAcCF.setLayout(null);
addNAcCF.setResizable(false);
addNAcCF.getContentPane().setBackground(Color.PINK);
addNAcCF.setVisible(true);
73 | P a g e
SUMAN BHANDARI
}
registerlabelNonAcademicTitle.setForeground(Color.BLACK);
registerNAcCF.add(registerlabelNonAcademicTitle);
registerLabelNonAcademicCourseID.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
registerLabelNonAcademicCourseID.setForeground(Color.BLUE);
registerNAcCF.add(registerNonAcademicCourseIDTF);
registerNAcCF.add(registerLabelNonAcademicCourseID);
74 | P a g e
SUMAN BHANDARI
registerLabelNonAcademicCourseLeader.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
registerLabelNonAcademicCourseLeader.setForeground(Color.BLUE);
registerNAcCF.add(registerNonAcademicCourseLeaderTF);
registerNAcCF.add(registerLabelNonAcademicCourseLeader);
registerLabelNonAcademicInstructorName.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
registerLabelNonAcademicInstructorName.setForeground(Color.BLUE);
registerNAcCF.add(registerNonAcademicInstructorNameTF);
registerNAcCF.add(registerLabelNonAcademicInstructorName);
registerLabelNonAcademicStartDate.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
registerLabelNonAcademicStartDate.setForeground(Color.BLUE);
75 | P a g e
SUMAN BHANDARI
registerNAcCF.add(registerNonAcademicStartDateTF);
registerNAcCF.add(registerLabelNonAcademicStartDate);
registerLabelNonAcademicCompletionDate.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
registerLabelNonAcademicCompletionDate.setForeground(Color.BLUE);
registerNAcCF.add(registerNonAcademicCompletionDateTF);
registerNAcCF.add(registerLabelNonAcademicCompletionDate);
registerLabelNonAcademicExamDate.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
registerLabelNonAcademicExamDate.setForeground(Color.BLUE);
registerNAcCF.add(registerNonAcademicExamDateTF);
registerNAcCF.add(registerLabelNonAcademicExamDate);
76 | P a g e
SUMAN BHANDARI
registerButtonDisplayNAC.setFocusable(false);
registerButtonDisplayNAC.setBackground(Color.RED);
registerButtonDisplayNAC.setOpaque(true);
registerButtonDisplayNAC.setForeground(Color.WHITE);
registerButtonDisplayNAC.addActionListener(new ActionListener() {
registerNAcCF.dispose();
removeNonAcademicCourse();
});
registerNAcCF.add(registerButtonDisplayNAC);
registerButtonRegisterNAC.setFocusable(false);
registerButtonRegisterNAC.setBackground(Color.RED);
registerButtonRegisterNAC.setOpaque(true);
registerButtonRegisterNAC.setForeground(Color.WHITE);
registerButtonRegisterNAC.addActionListener(new ActionListener() {
77 | P a g e
SUMAN BHANDARI
String courseID = getRegisterNonAcademicCourseIDTF();
if (courseID.equals("") || courseLeader.equals("") ||
instructorName.equals("")
|| startDate.equals("") || completionDate.equals("") ||
examDate.equals("")) {
2);
return;
} else {
if (listing.isEmpty() == true) {
return;
} else {
78 | P a g e
SUMAN BHANDARI
if (courseRtr.getCourseId().equalsIgnoreCase(courseID)) {
NonAcademicCourse aC = (NonAcademicCourse)
courseRtr;
if (aC.isRegistered() == true) {
JOptionPane.showMessageDialog(null, "Course is
registered already.",
return;
} else {
examDate);
return;
} else {
flag = true;
79 | P a g e
SUMAN BHANDARI
if (flag == true) {
JOptionPane.showMessageDialog(null, "Non-Academic
Course isnot identified.",
"Identification", JOptionPane.WARNING_MESSAGE);
return;
});
registerNAcCF.add(registerButtonRegisterNAC);
registerButtonClearNAC.setFocusable(false);
registerButtonClearNAC.setBackground(Color.RED);
registerButtonClearNAC.setOpaque(true);
registerButtonClearNAC.setForeground(Color.WHITE);
registerButtonClearNAC.addActionListener(new ActionListener() {
registerNonAcademicCourseIDTF.setText("");
80 | P a g e
SUMAN BHANDARI
registerNonAcademicCourseLeaderTF.setText("");
registerNonAcademicInstructorNameTF.setText("");
registerNonAcademicStartDateTF.setText("");
registerNonAcademicCompletionDateTF.setText("");
registerNonAcademicExamDateTF.setText("");
});
registerNAcCF.add(registerButtonClearNAC);
registerButtonCancelNAC.setFocusable(false);
registerButtonCancelNAC.setBackground(Color.RED);
registerButtonCancelNAC.setOpaque(true);
registerButtonCancelNAC.setForeground(Color.WHITE);
registerButtonCancelNAC.addActionListener(new ActionListener() {
System.exit(0);
});
registerNAcCF.add(registerButtonCancelNAC);
81 | P a g e
SUMAN BHANDARI
registerNAcCF.setSize(750, 500);
registerNAcCF.setResizable(false);
registerNAcCF.setLayout(null);
registerNAcCF.setLocationRelativeTo(null);
registerNAcCF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
registerNAcCF.setVisible(true);
registerNAcCF.getContentPane().setBackground(Color.PINK);
removeNonAcademicTitleLabel.setForeground(Color.BLACK);
removeNonAcCF.add(removeNonAcademicTitleLabel);
removeLabelNonAcademicCourseID.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));
82 | P a g e
SUMAN BHANDARI
removeLabelNonAcademicCourseID.setForeground(Color.BLUE);
removeNonAcCF.add(displayAcademicCourseIDTF);
removeNonAcCF.add(removeLabelNonAcademicCourseID);
removeNonAcCF.add(txtAreaDplayNonAcCourse);
removeButtonDisplayNAC.setFocusable(false);
removeButtonDisplayNAC.setBackground(Color.RED);
removeButtonDisplayNAC.setOpaque(true);
removeButtonDisplayNAC.setForeground(Color.WHITE);
removeButtonDisplayNAC.addActionListener(new ActionListener() {
83 | P a g e
SUMAN BHANDARI
if (listing.isEmpty() == true) {
flag = true;
} else {
if (courseDplay.getCourseId().equalsIgnoreCase(courseID)) {
NonAcademicCourse aF = (NonAcademicCourse)
courseDplay;
if (aF.isRegistered() == true) {
aF.display();
txtAreaDplayNonAcCourse.setText("Course ID : "
+ getAddNonAcademicCourseIDTF() + "\nCourse
Name : "
+ getAddNonAcademicCourseNameTF() +
"\nCredit : "
+ getAddNonAcademicDurationTF() +
"\nPrerequisite : "
+ getAddNonAcademicPrerequisiteTF());
return;
} else {
flag = true;
84 | P a g e
SUMAN BHANDARI
}
if (flag == true) {
return;
});
removeNonAcCF.add(removeButtonDisplayNAC);
removeButtonRemoveNAC.setFocusable(false);
removeButtonRemoveNAC.setBackground(Color.RED);
removeButtonRemoveNAC.setOpaque(true);
removeButtonRemoveNAC.setForeground(Color.WHITE);
85 | P a g e
SUMAN BHANDARI
removeButtonRemoveNAC.addActionListener(new ActionListener() {
if (listing.isEmpty() == true) {
return;
} else {
if (courseRm.getCourseId().equalsIgnoreCase(courseID)) {
if (course.isRemoved() == true) {
return;
else{
course.remove();
txtAreaDplayNonAcCourse.setText("");
86 | P a g e
SUMAN BHANDARI
JOptionPane.showMessageDialog(null, "Course is
removed.", "Remove Course", 1);
return;
} else {
flag = true;
if (flag == true) {
return;
});
removeNonAcCF.add(removeButtonRemoveNAC);
87 | P a g e
SUMAN BHANDARI
removeNonAcCF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
removeNonAcCF.setSize(700, 500);
removeNonAcCF.setLocationRelativeTo(null);
removeNonAcCF.setLayout(null);
removeNonAcCF.setResizable(false);
removeNonAcCF.getContentPane().setBackground(Color.PINK);
removeNonAcCF.setVisible(true);
abc.registerAcademicCourse();
abc.displayAcademicCourse();
abc.removeNonAcademicCourse()
abc.addAcademicCourse();
abc.addNonAcademicCourse();
abc.registerNonAcademicCourse();
88 | P a g e
SUMAN BHANDARI
89 | P a g e
SUMAN BHANDARI