0% found this document useful (0 votes)
42 views94 pages

Java Coursework2.0

Uploaded by

Romu cdy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views94 pages

Java Coursework2.0

Uploaded by

Romu cdy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 94

Module Code & Module Title

CS4001NT Java Programming

Assessment Weightage & Type


30 % Individual Coursework -2

Year and Semester


2020-21 Spring, Semester

Student Name: Suman Bhandari


College ID: NP05CP4S210041
Assignment Submission Date: 2021/08/20

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

1. Introduction of Java Programming ....................................................................... 1

1.2 Component of java............................................................................................ 1

1.3 Features of Java Programming Language ........................................................ 2

1.4 Java Swing and Java AWT ............................................................................... 2

1.5. Goals and Objectives ....................................................................................... 2

2. Class Diagram ..................................................................................................... 4

2.1. INGWorld Class Diagram ................................................................................ 5

3. Pseudo Code for each method in each class ...................................................... 8

3.1 ING_World class ............................................................................................... 8

4. Short Description of Methods............................................................................. 18

4.1. INGCollege Class........................................................................................ 18

5. Testing ............................................................................................................... 22

5.1. Test 1 ............................................................................................................. 22

5.2. Test 2 ............................................................................................................. 23

5.2.a...................................................................................................................... 23

5.2.b...................................................................................................................... 24

5.2.c. ..................................................................................................................... 25

5.2.d...................................................................................................................... 26

5.3. Test 3 ............................................................................................................. 27

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

6.2. Semantic Errors ............................................................................................. 34

6.3. Logical errors ................................................................................................. 35

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.

GUI is a Graphical Interface that is a optical demonstration of communication


displayed to the user for simple communication with the machine. GUI means
Graphical User Interface. It is the common user Interface that incorporates Graphical
demonstration like buttons and symbols, and communication can be performed by
connection with these symbols rather than the regular text-based or command-based
communication (Pedamkar, 2021).

1.2 Component of java


There are three component of java programming which is shown below:

• 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).

1.3 Features of Java Programming Language


The lists of features of Java Programming Language are shown below:

• Object Oriented
• High Performance
• Dynamic
• Simple
• Platform Independent
• Secure
• Portable
• Interpreted

1.4 Java Swing and Java AWT


Java Swing lesson is a part of Java Groundwork Classes (JFC) that is utilized to
fashion window-based applications. It is built on the top of AWT (Extract Windowing
Toolkit) API and totally composed in java. JLabel, JFrame, JButton, JTextField,
JTextArea are ost Common Java Swing components for windows-based application
(GUI). And Java AWT components are platform-dependent components are shown
concurring to the vision of functioning arrangement. AWT is paper its components are
utilizing the possessions of OS. Frame, Panel, Dialog, Button, Window are most
Common Java AWT components for windows-based application (GUI) (javapoint,
2021).

1.5. Goals and Objectives


The goals and objectives of this project is to build or build up a GUI based on the Java
programming used for the educational organization which has recorded the separate
way for the specific educational organization. In this project, there is GUI to be built.
At first, I would like to describe the term “GUI” in java. GUI is a optical knowledge
builder for Java programs that is simple to use. They are mostly made up of graphical

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.

Figure 1: Class Diagram

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

3.1 ING_World class

FUNCTION return type “String” getAddAcademicCourseIDTF ()

DO

EXTRACT the value of addAcademicCourseIDTF and

RETURN the value of addAcademicCourseIDTF

END DO

FUNCTION return type “String” getAddAcademicCourseTF ()

DO

EXTRACT the value of addAcademicCourseTF and

RETURN the value of addAcademicCourseTF

END DO

FUNCTION return type “String” getAddAcademicDurationTextField()

DO

EXTRACT the value of addAcademicDurationTF and

RETURN the value of addAcademicDurationTF

END DO

FUNCTION return type “String” getAddAcademicLevelTF ()

DO

EXTRACT the value of addAcademicLevelTF and

8|Page
SUMAN BHANDARI
RETURN the value of addAcademicLevelTF

END DO

FUNCTION return type “String” getAddAcademicCreditTF ()

DO

EXTRACT the value of addAcademicCreditTF and

RETURN the value of addAcademicCreditTF

END DO

FUNCTION return type “String” getAddAcademicNo_Of_AssessmentsTF ()

DO

EXTRACT the value of addAcademicNo_of_AssessmentsTF and

RETURN the value of addAcademicNo_of_AssessmentsTF

END DO

FUNCTION return type “String” getRegisterAcademicCourseIDTF ()

DO

EXTRACT the value of registerAcademicCourseIDTF and

RETURN the value of registerAcademicCourseIDTF

END DO

9|Page
SUMAN BHANDARI
FUNCTION return type “String” getRegisterAcademicCourseLeaderTF ()

DO

EXTRACT the value of registerAcademicCourseLeaderTF and

RETURN the value of registerAcademicCourseLeaderTF

END DO

FUNCTION return type “String” getRegisterAcademicLecturerNameTF ()

DO

EXTRACT the value of registerAcademicLecturerNameTF and

RETURN the value of registerAcademicLecturerNameTF

END DO

FUNCTION return type “String” getRegisterAcademicStartDateTF ()

DO

EXTRACT the value of registerAcademicStartDateTF and

RETURN the value of registerAcademicStartDateTF

END DO

FUNCTION return type “String” getRegisterAcademicCompletionDateTF ()

DO

EXTRACT the value of registerAcademicCompletionDateTF and

RETURN the value of registerAcademicCompletionDateTF

10 | P a g e
SUMAN BHANDARI
END DO

FUNCTION return type “String” getDisplayAcademicCourseIDTF ()

DO

EXTRACT the value of displayAcademicCourseIDTF and

RETURN the value of displayAcademicCourseIDTF

END DO

FUNCTION return type “String” getAddNonAcademicCourseIDTF ()

DO

EXTRACT the value of addNonAcademicCourseIDTF and

RETURN the value of addNonAcademicCourseIDTF

END DO

FUNCTION return type “String” getAddNonAcademicCourseNameTF ()

DO

EXTRACT the value of addNonAcademicCourseNameTF and

RETURN the value of addNonAcademicCourseNameTF

END DO

FUNCTION return type “String” getAddNonAcademicDurationTF ()

DO

EXTRACT the value of addNonAcademicDurationTF and

RETURN the value of addNonAcademicDurationTF

11 | P a g e
SUMAN BHANDARI
END DO

FUNCTION return type “String” getAddNonAcademicPrerequisiteTF ()

DO

EXTRACT the value of addNonAcademicPrerequisiteTF and

RETURN the value of addNonAcademicPrerequisiteTF

END DO

FUNCTION return type “String” getRegisterNonAcademicCourseIDTF ()

DO

EXTRACT the value of registerNonAcademicCourseIDTF and

RETURN the value of registerNonAcademicCourseIDTF

END DO

FUNCTION return type “String” getRegisterNonAcademicCourseLeaderTF ()

DO

EXTRACT the value of registerNonAcademicCourseLeaderTF and

RETURN the value of registerNonAcademicCourseLeaderTF

END DO

FUNCTION return type “String” getRegisterNonAcademicInstructorNameTF ()

DO

EXTRACT the value of registerNonAcademicInstructorNameTF and

RETURN the value of registerNonAcademicInstructorNameTF

END DO

12 | P a g e
SUMAN BHANDARI
FUNCTION return type “String” getRegisterNonAcademicStartDateTF ()

DO

EXTRACT the value of registerNonAcademicStartDateTF and

RETURN the value of registerNonAcademicStartDateTF

END DO

FUNCTION return type “String” getRegisterNonAcademicCompletionDateTF ()

DO

EXTRACT the value of registerNonAcademicCompletionDateTF and

RETURN the value of registerNonAcademicCompletionDateTF

END DO

FUNCTION return type “String” getRegisterNonAcademicExamDateTF ()

DO

EXTRACT the value of registerNonAcademicExamDateTF and

RETURN the value of registerNonAcademicExamDateTF

END DO

FUNCTION return type “String” getRemoveNonAcademicCourseIDTF ()

DO

EXTRACT the value of removeNonAcademicCourseIDTF and

RETURN the value of removeNonAcademicCourseIDTF

END DO

13 | P a g e
SUMAN BHANDARI
FUNCTION non-return type “void” addAcademicCourse ()

DO

addAcf = new JFrame("INGWorld")

addActitLabel = new JLabel("Academic Course")

addActitLabel.setForeground(Color.BLACK)

addActitLabel.setFont(new FontUIResource("Times New

Roman", Font.BOLD, 23))

addActitLabel.setBounds(270, 10, 200, 50)

addAcf.add(addActitLabel)

addIdAcademiccourse = new JLabel("Course ID:")

addIdAcademiccourse.setForeground(Color.BLUE)

addIdAcademiccourse.setFont(new

FontUIResource("Monospace", Font.BOLD, 14))

addIdAcademiccourse.setBounds(40, 71, 100, 50)

addAcademicCourseIDTF = new JTextField()

addAcademicCourseIDTF.setBounds(120, 86, 200, 25)

addAcf.add(addAcademicCourseIDTF)

addAcf.add(addIdAcademiccourse)

addlabelAcademicCourseName = new JLabel("Course

Name:")

addlabelAcademicCourseName.setBounds(340, 71, 100,

50);

addlabelAcademicCourseName.setFont(new

14 | P a g e
SUMAN BHANDARI
FontUIResource("Monospace", Font.BOLD, 14))

addlabelAcademicCourseName.setForeground(Color.BLUE)

addAcademicCourseNameTF = new JTextField()

addAcademicCourseNameTF.setBounds(440, 86, 200, 25)

addAcf.add(addAcademicCourseNameTF)

addAcf.add(addlabelAcademicCourseName)

addlabelAcademicDuration = new JLabel("Duration:")

addlabelAcademicDuration.setBounds(52, 130, 100, 50)

addlabelAcademicDuration.setFont(newFontUIResource("Monospace",

Font.BOLD, 14))

addlabelAcademicDuration.setForeground(Color.BLUE)

addAcademicDurationTF = new JTextField()

addAcademicDurationTF.setBounds(120, 145, 200, 25)

addAcf.add(addAcademicDurationTF)

addAcf.add(addlabelAcademicDuration)

addlabelAcademicLevel = new JLabel("Level:")

addlabelAcademicLevel.setBounds(395, 130, 100, 50)

addlabelAcademicLevel.setFont(newFontUIResource("Monospace",

Font.BOLD, 14))

addlabelAcademicLevel.setForeground(Color.BLUE)

addAcademicLevelTF = new JTextField()

addAcademicLevelTF.setBounds(440, 145, 200, 25)

addAcf.add(addAcademicLevelTF)

15 | P a g e
SUMAN BHANDARI
addAcf.add(addlabelAcademicLevel)

addAcademicNo_of_AssessmentsLabel = new

JLabel("Number_of_Assessments:")

addAcademicNo_of_AssessmentsLabel.setBounds(5, 189, 200, 50)

addAcademicNo_of_AssessmentsLabel.setFont(new

FontUIResource("Monospace", Font.BOLD, 14))

a ddAcademicNo_of_AssessmentsLabel.setForeground(Color.BLUE)

addAcademicNo_of_AssessmentsTF = new JTextField()

addAcademicNo_of_AssessmentsTF.setBounds(173, 204, 145, 25)

addAcf.add(addAcademicNo_of_AssessmentsTF)

addAcf.add(addAcademicNo_of_AssessmentsLabel)

addAcademicCreditLabel = new JLabel("Credit:")

addAcademicCreditLabel.setBounds(385, 189, 100, 50)

addAcademicCreditLabel.setFont(new FontUIResource("Monospace",

Font.BOLD, 14))

addAcademicCreditLabel.setForeground(Color.BLUE)

addAcademicCreditTF = new JTextField()

addAcademicCreditTF.setBounds(440, 203, 200, 25)

addAcf.add(addAcademicCreditTF)

addAcf.add(addAcademicCreditLabel)

addbuttonAC = new JButton("Add")

addbuttonAC.setBounds(173, 265, 130, 40)

addbuttonAC.setFocusable(false)

addbuttonAC.setFont(new Font("Comic Sans Ms",

16 | P a g e
SUMAN BHANDARI
Font.BOLD, 15))

addbuttonAC.setBackground(Color.RED)

addbuttonAC.setOpaque(true)

addbuttonAC.setForeground(Color.WHITE)

CALL actionPerformed (ActionEvent e)

Do

INITIALIZE courseID as a ‘String’ equals to getAddAcademicCourse

IDTF()

INITIALIZE courseName as a ‘String’ equals to

getAddAcademicCourseNameTF()

INITIALIZE duration as a ‘String’ equals to getAddAcademicduration

TF()

INITIALIZE lavel as a ‘String’ equals to getAddAcademiclavelTF()

INITIALIZE credit as a ‘String’ equals to getAddAcademiccreditTF()

INITIALIZE noofAssessments as a ‘String’ equals to getAddAcademic

noofAssessmentsField()

DECLARE duration and noOfAssessments as a ‘integer

INITIALIZE flag as a ‘boolean’ equals to true

IF the value of courseID is equals to “” or the value of courseName is

equals to “” or the value of durationString is equals to “” or the value of

level is equals to “” or the value of credit is equals to “” or the value of

noOfAssessmentsString is equals to “”

DO

17 | P a g e
SUMAN BHANDARI
4. Short Description of Methods
4.1. INGCollege Class

• getAddAcademicCourrseIDTF (): This method helps to get the value of


addAcademicCourseIDTF. This method is a return type method.
• getAddAcademicCourseNameTF (): This method helps to get the value of
addAcademicCourseIDTF. This method is a return type method
• getAddAcademicDurationTF (): This method helps to get the value of
addAcademicDurationTF. This method is a return type method.
• getAddAcademicLevelTF (): This method helps to get the value of
addAcademicLevelTF. This method is a return type method.
• getAddAcademicCreditTF (): This method helps to get the value of
addAcademicCreditTF. This method is a return type method.
• getAddAcademicNo_Of_AssessmentsTF (): This method helps to get the
value of addAcademic No_Of_Assessments TF. This method is a return type
method.
• getRegisterAcademicCourseIDTF (): This method helps to get the value of
registerAcademicCourseID TF. This method is a return type method.
• getRegisterAcademicCourseLeaderTF (): This method helps to get the value
of registerAcademicCourseID TF. This method is a return type method.
• getRegisterAcademicLecturerNameTF (): This method helps to get the value
of registerAcademicLecturerName TF. This method is a return type method.
• getRegisterAcademicStartDateTF (): This method helps to get the value of
registerAcademicStartDateTF. This method is a return type method.
• getRegisterAcademicCompletionDateTF (): This method helps to get the
value of registerAcademicCompletionDate TF. This method is a return type
method.
• getDisplayAcademicCourseIDTF (): This method helps to get the value of
displayAcademicCourseIDTF. This method is a return type method.
• getNonAcademicCourseIDTF (): This method helps to get the value of
addNonAcademicCourseIDTF. This method is a return type method.
• getNonAcademicCourseNameTF (): This method helps to get the value of
add NonAcademicCourseNameTF. This method is a return type method.

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

• registerAcademicCourse (): This method helps to register the course of


AcademicCourse. This method is a void return type method which means non-
return type. This method contains a frame which consists of four different
buttons with different functionality. The buttons are like:
1) registerbuttonAC
2) registerclearACButton
3) registerACDisplayButton
4) registerACCancelButton

• displayAcademicCourse (): This method helps to display the course of the


AcademicCourse. This method is a void return type method which means non-
return type. This method contains a frame which consists of four different
buttons with their own special functions. The buttons
• addNAcCF (): This method helps to add all the course of NonAcademic Course.
This method helps to create addNAcCF. This method is a void return type
method which means non-return type.

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

• registerNonAcademicCourse (): This method helps to register the course of


Non AcademicCourse. This method is a void return type method which means
non-return type. This method contains a frame which consists of 4 buttons of
different special functions. The buttons are like:
1) registerButtonRegisterNAC
2) registerButtonClearNAC
3) registerButtonDisplayNAC
4) registerButtonCancelNAC

• removeNonAcademicCourse (): This method helps to remove and display


the NonAcademicCourse. This method is a void return type method which
means non-return type. This method contains a frame which consists of two
buttons. The buttons are like:
1) removeButtonRemoveNAC
2) removeButttonDisplayNAC

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

Objective To examination whether the program can be compiled and


run by means of the command prompt (cmd).
Action Subsequent commands is used to compile and run the
INGWorld program of codes is:

-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.

Figure 2: Testing the program using command prompt

22 | P a g e
SUMAN BHANDARI
5.2. Test 2
5.2.a.
Table 2: Testing table to add course for AcademicCourse

Objective To add course for AcademicCourse(AC)


Action The following values are entered on the respective textfields to
add course to the AcademicCourse:
courseId=” ST16460M”
courseName=” Java”
duration= 6
level=T025
Credit=A
No_of_Assessments: 14

Expected The course of AcademicCourse must be included showing the


Result suitable message dialog box.
Actual Result The course of AcademicCourse is included presenting/displaying
the dialog box.
Conclusion Test successful

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

Objective To add course for NonAcademicCourse.


Action The subsequent values are entered on the individual text fields to
add course to the NonAcademicCourse:
CourseId=”ST16460M”
CourseName=Java
Duration= 6
Prerequisite: Stay Focus

Expected Result The course of Non AcademicCourse must be included showing


the suitable message dialog box
Actual Result The course of AcademicCourse is included presenting/displaying
the dialog box.
Conclusion Test successful.

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:

Objective To test for registering the AcademicCourse..


Action The subsequent values are entered on the respective textfields to
add course to the AcademicCourse in the addAcademic Course
Frame:
CourseId=”ST16460M”
CourseName=Java
Duration= 6
level=T025
Credit: A
No_of_Assessments: 14
The subsequent values are entered on the respective textfields
for registering the AcademicCourse in the
registerAcademicCourse Frame:
Course ID:”ST16460M”
Course Leader: Nishan Nepal
Lecturer Name: Sujan Basnet
Start Date: 2021-07-28
Completion Date: 2021-08-05

Expected Result The course of AcademicCourse should be registered displaying


the suitable message dialog box.
Actual Result The course of AcademicCourse is included presenting/displaying
the dialog box.
Conclusion Test successful.

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

Objective To test for registering the NonAcademicCourse..


Action The subsequent values are entered on the respective textfields to add
course to the AcademicCourse in the addAcademicCourse Frame:
CourseId=”ST16460M”
CourseName=Java
Duration= 6
Prerequisite: Stay Focus
The subsequent values are entered on the respective textfields for
registering the AcademicCourse in the registerNonAcademicCourse
Frame:
Course ID:”ST16460M”
Course Leader: Nishan Nepal
Lecturer Name: Muksham Limbu
Start Date: 2021-07-28
Completion Date: 2021-08-05
Exam Date: 2021-08-20

Expected Result The course of NonAcademicCourse should be registered displaying


the suitable message dialog box.

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

Objective Examine to add the duplicate courseID of AcademicCourse.


Action Subsequent values are entered on the respective textfields to add
course to the AcademicCourse in the addAcademicCourseFrame:
CourseId=”ST16460M”
CourseName=Java
Duration= 6
level=T025
Credit: A
No_of_Assessments: 14

Subsequent values are entered on the respective textfields for


registering the AcademicCourse in the addAcademicCourseFrame:

27 | P a g e
SUMAN BHANDARI
Course ID:”ST16460M”
Course Name: Java
Duration= 6
level=T025
Credit: A
No_of_Assessments: 14

Expected Result The duplicate CourseID should be displayed.


Actual Result The duplicate CourseID is displayed in AcademicCourse.
Conclusion Test successful.

Figure 7: Testing figure to add the duplicate courseID of Academic Course

28 | P a g e
SUMAN BHANDARI
5.3.a.2.
Table 7: Testing table to add duplicate courseID of Non-Academic Course

Objective Examine to add the duplicate courseID of NonAcademicCourse.


Action Subsequent values are entered on the respective textfields to add
course to the NonAcademicCourse in the addNonAcademicCourse
Frame:
CourseId=”ST16460M”
CourseName=Java
Duration= 6
Prerequisite: Stay Focus

Subsequent values are entered on the respective textfields to add


Course to the NonAcademicCourse in the addNonAcademicCourse
Frame:
Course ID:”ST16460M”
Course Name: Java
Duration= 6
Prerequisite: Stay Focus

Expected Result Duplicate CourseID of NonAcademicCourse should be displayed.


Actual Result Duplicate CourseID is displayed in NonAcademicCourse.
Conclusion Test successful.

Figure 8: To add 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

Objective Examine to register the already registered course in Academic


Course.
Action subsequent values are entered on the respective textfields to add
course to the AcademicCourse in the addAcademicCourse Frame:
CourseId=”ST16460M”
CourseName=Java
Duration= 6
level=T025
Credit: A
No_of_Assessments: 14

subsequent values are entered on the respective textfields for


registering the AcademicCourse in the registerNonAcademicCourse
Frame:
Course ID:”ST16460M”
Course Leader: Nishan Nepal
Lecturer Name: Sujan Basnet
Start Date: 2021-07-28
Completion Date: 2021-08-05

Expected Result Academic Course is already registered should be displayed.


Actual Result Academic Course is already registered is displayed.
Conclusion Test successful.

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

Objective Examine to register the already registered course in NonAcademic Course.


Action subsequent values are entered on the respective textfields to add course
to the NonAcademicCourse in the addNonAcademicCourse Frame:
CourseId=”ST16460M”
CourseName=Java
Duration= 6
Prerequisite: Stay Focus
subsequent values are entered on the respective textfields for registering
the NonAcademicCourse in the registerNonAcademicCourse Frame:
Course ID:”ST16460M”
Course Leader: Nishan Nepal
Instructor Name: Muksham Limbu
Start Date: 2021-07-28
Completion Date: 2021-08-05
Exam Date: 2021-08-20

Expected Result NonAcademicCourse is already registered should be displayed.


Actual Result NonAcademicCourse is already registered is displayed.
Conclusion Test successful.

31 | P a g e
SUMAN BHANDARI
Figure 10: To register the already register course in Non-Academic Course

5.3.c
Table 10

Objective To test to remove the already removed course in NonAcademic Course.


Action subsequent values are entered on the respective textfields to add course to
the NonAcademicCourse in the addNonAcademicCourse Frame:
CourseId=”ST16460M”
CourseName=Java
Duration= 6
Prerequisite: Stay Focus
subsequent values are entered on the respective textfields for registering the
NonAcademicCourse in the registerNonAcademicCourse Frame:
Course ID:”ST16460M”
Course Leader: Nishan Nepal
Instructor Name: Muksham Limbu
Start Date: 2021-07-28
Completion Date: 2021-08-05
Exam Date: 2021-08-20

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”

Expected Result NonAcademicCourse is already removed registered should be displayed.


Actual Result NonAcademicCourse is already removed registered is displayed.
Conclusion Test successful.

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.

Figure 11: Detecting the Error

Figure 12: Fixing the error

6.2. Semantic Errors


During the semantic examination point, this kind of error shows up. These sorts of
error are recognized at compile time. Most of the compile time errors are scale and
declaration error. For example: undeclared or various declared identifiers. Type

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.

Figure 13: Detecting the semantic error

Figure 14: fixing the error

6.3. Logical errors


A logic error is a error in a program's source code that marks in wrong or unpredicted
behaviour. It is a type of runtime error to might easily produce the incorrect output or
might cause a program to crash while running. Many separate types of encoding
mistakes can cause logic errors. For instance, conveying a value to the incorrect
variable may cause a series of unexpected program errors. Multiplying two numbers
instep of calculation them together may also make unnecessary results. Even minor
typos that do not make syntax errors may cause logic errors (TechTerms, 2021). I
have given example of Runtime error and correcting the error 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

Figure 17: 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].

Education, I. C., 2020. JRE (Java Runtime Environment). [Online]


Available at: https://www.ibm.com/cloud/learn/jre
[Accessed 9 August 2021].

GeeksforGeeks, 2020. Types of Errors in Java with Examples. [Online]


Available at: https://www.geeksforgeeks.org/types-of-errors-in-java-with-examples/
[Accessed 10 August 2021].

javapoint, 2021. Java swing and AWT Tutorial. [Online]


Available at: https://www.javatpoint.com/java-awt
[Accessed 9 August 2021].

Javapoint, 2021. Semantic Error. [Online]


Available at: https://www.javatpoint.com/semantic-error
[Accessed 10 August 2021].

Pedamkar, P., 2021. What is GUI?. [Online]


Available at: https://www.educba.com/what-is-gui/
[Accessed 10 August 2021].

techopedia, 2020. Java Development Kit (JDK). [Online]


Available at: https://www.techopedia.com/definition/5594/java-development-kit-jdk
[Accessed 9 August 2021].

TechTerms, 2021. Logic Error Definition. [Online]


Available at: https://techterms.com/definition/logic_error
[Accessed 10 August 2021].

39 | P a g e
SUMAN BHANDARI
9. Appendix
/**

* Write a description of class ING_World here.

* @author (Suman Bhandari)

* @version (a version number or a date)

*/

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 {

private ArrayList<Course> listing = new ArrayList<Course>();

// Acf=AcademicCourseFrame

public JFrame addAcf, registerAcf, displayAcf,

// NonAcademic frame

addNAcCF, registerNAcCF, removeNonAcCF;

public JLabel addActitLabel, registerlabelAcademicTitle,


displaylavelAcademicTitle, addIdAcademiccourse,

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;

public JTextField addAcademicCourseIDTF, addAcademicCourseNameTF,


addAcademicDurationTF, addAcademicLevelTF,

addAcademicCreditTF, addAcademicNo_of_AssessmentsTF,
registerAcademicCourseIDTF,

registerAcademicCourseLeaderTF, registerAcademicLecturerNameTF,
registerAcademicStartDateTF,

registerAcademicCompletionDateTF, displayAcademicCourseIDTF,

// NonAcademic textfield

addNonAcademicCourseIDTF, addNonAcademicCourseNameTF,
addNonAcademicDurationTF,

addNonAcademicPrerequisiteTF, registerNonAcademicCourseIDTF,
registerNonAcademicCourseLeaderTF,

registerNonAcademicInstructorNameTF, registerNonAcademicStartDateTF,
registerNonAcademicCompletionDateTF,

registerNonAcademicExamDateTF, removeNonAcademicCourseIDTF;

public JButton addbuttonAC, addbuttonClearAC, addbuttonCancelAC,


addbuttonRegisterAC, registerbuttonAC,

42 | P a g e
SUMAN BHANDARI
registerclearACButton, registerACDisplayButton, registerACCancelButton,
displayDisplayAButton,

// NonAcademic Button

addButtonNAC, addButtonClearNAC, addButtonCancelNAC,


addButtonRegisterNAC, registerButtonRegisterNAC,

registerButtonClearNAC, registerButtonCancelNAC,
registerButtonDisplayNAC, removeButtonRemoveNAC,

removeButtonDisplayNAC;

private JTextArea txtAreaDplayAcCourse, txtAreaDplayNonAcCourse;

// Academic Course

public String getAddAcademicCourseIDTF() {

return addAcademicCourseIDTF.getText();

public String getAddAcademicCourseNameTF() {

return addAcademicCourseNameTF.getText();

public String getAddAcademicDurationTextField() {

return addAcademicDurationTF.getText();

43 | P a g e
SUMAN BHANDARI
public String getAddAcademicLevelTF() {

return addAcademicLevelTF.getText();

public String getAddAcademicCreditTF() {

return addAcademicCreditTF.getText();

public String getAddAcademicNo_Of_AssessmentsTF() {

return addAcademicNo_of_AssessmentsTF.getText();

public String getRegisterAcademicCourseIDTF() {

return registerAcademicCourseIDTF.getText();

public String getRegisterAcademicCourseLeaderTF() {

return registerAcademicCourseLeaderTF.getText();

public String getRegisterAcademicLecturerNameTF() {

return registerAcademicLecturerNameTF.getText();

44 | P a g e
SUMAN BHANDARI
public String getRegisterAcademicStartDateTF() {

return registerAcademicStartDateTF.getText();

public String getRegisterAcademicCompletionDateTF() {

return registerAcademicCompletionDateTF.getText();

public String getDisplayAcademicCourseIDTF() {

return displayAcademicCourseIDTF.getText();

// Non Academic Course

public String getAddNonAcademicCourseIDTF() {

return addNonAcademicCourseIDTF.getText();

public String getAddNonAcademicCourseNameTF() {

return addNonAcademicCourseNameTF.getText();

public String getAddNonAcademicDurationTF() {

return addNonAcademicDurationTF.getText();

45 | P a g e
SUMAN BHANDARI
public String getAddNonAcademicPrerequisiteTF() {

return addNonAcademicPrerequisiteTF.getText();

public String getRegisterNonAcademicCourseIDTF() {

return registerNonAcademicCourseIDTF.getText();

public String getRegisterNonAcademicCourseLeaderTF() {

return registerNonAcademicCourseLeaderTF.getText();

public String getRegisterNonAcademicInstructorNameTF() {

return registerNonAcademicInstructorNameTF.getText();

public String getRegisterNonAcademicStartDateTF() {

return registerNonAcademicStartDateTF.getText();

public String getRegisterNonAcademicCompletionDateTF() {

return registerNonAcademicCompletionDateTF.getText();

46 | P a g e
SUMAN BHANDARI
public String getRegisterNonAcademicExamDateTF() {

return registerNonAcademicExamDateTF.getText();

public String getRemoveNonAcademicCourseIDTF() {

return removeNonAcademicCourseIDTF.getText();

public void addAcademicCourse() {

addAcf = new JFrame("INGWorld");

addActitLabel = new JLabel("Academic Course");

addActitLabel.setForeground(Color.BLACK);

addActitLabel.setFont(new FontUIResource("Times New Roman", Font.BOLD,


23));

addActitLabel.setBounds(270, 10, 200, 50);

addAcf.add(addActitLabel);

addIdAcademiccourse = new JLabel("Course ID:");

addIdAcademiccourse.setForeground(Color.BLUE);

addIdAcademiccourse.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));

addIdAcademiccourse.setBounds(40, 71, 100, 50);

addAcademicCourseIDTF = new JTextField();

47 | P a g e
SUMAN BHANDARI
addAcademicCourseIDTF.setBounds(120, 86, 200, 25);

addAcf.add(addAcademicCourseIDTF);

addAcf.add(addIdAcademiccourse);

addlabelAcademicCourseName = new JLabel("Course Name:");

addlabelAcademicCourseName.setBounds(340, 71, 100, 50);

addlabelAcademicCourseName.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));

addlabelAcademicCourseName.setForeground(Color.BLUE);

addAcademicCourseNameTF = new JTextField();

addAcademicCourseNameTF.setBounds(440, 86, 200, 25);

addAcf.add(addAcademicCourseNameTF);

addAcf.add(addlabelAcademicCourseName);

addlabelAcademicDuration = new JLabel("Duration:");

addlabelAcademicDuration.setBounds(52, 130, 100, 50);

addlabelAcademicDuration.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));

addlabelAcademicDuration.setForeground(Color.BLUE);

addAcademicDurationTF = new JTextField();

addAcademicDurationTF.setBounds(120, 145, 200, 25);

addAcf.add(addAcademicDurationTF);

addAcf.add(addlabelAcademicDuration);

addlabelAcademicLevel = new JLabel("Level:");

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);

addAcademicLevelTF = new JTextField();

addAcademicLevelTF.setBounds(440, 145, 200, 25);

addAcf.add(addAcademicLevelTF);

addAcf.add(addlabelAcademicLevel);

addAcademicNo_of_AssessmentsLabel = new
JLabel("Number_of_Assessments:");

addAcademicNo_of_AssessmentsLabel.setBounds(5, 189, 200, 50);

addAcademicNo_of_AssessmentsLabel.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

addAcademicNo_of_AssessmentsLabel.setForeground(Color.BLUE);

addAcademicNo_of_AssessmentsTF = new JTextField();

addAcademicNo_of_AssessmentsTF.setBounds(173, 204, 145, 25);

addAcf.add(addAcademicNo_of_AssessmentsTF);

addAcf.add(addAcademicNo_of_AssessmentsLabel);

addAcademicCreditLabel = new JLabel("Credit:");

addAcademicCreditLabel.setBounds(385, 189, 100, 50);

addAcademicCreditLabel.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));

addAcademicCreditLabel.setForeground(Color.BLUE);

49 | P a g e
SUMAN BHANDARI
addAcademicCreditTF = new JTextField();

addAcademicCreditTF.setBounds(440, 203, 200, 25);

addAcf.add(addAcademicCreditTF);

addAcf.add(addAcademicCreditLabel);

addbuttonAC = new JButton("Add");

addbuttonAC.setBounds(173, 265, 130, 40);

addbuttonAC.setFocusable(false);

addbuttonAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

addbuttonAC.setBackground(Color.RED);

addbuttonAC.setOpaque(true);

addbuttonAC.setForeground(Color.WHITE);

addbuttonAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// System.out.println("Hellow");

String courseID = getAddAcademicCourseIDTF();

String courseName = getAddAcademicCourseNameTF();

String level = getAddAcademicLevelTF();

String durationStr = getAddAcademicDurationTextField();

String noOfAssessmentsStr =
getAddAcademicNo_Of_AssessmentsTF();

String credit = getAddAcademicCreditTF();

boolean flag = false;

50 | P a g e
SUMAN BHANDARI
int duration, noOfAssessments;

if (courseID.equals("") || courseName.equals("") || durationStr.equals("")


|| level.equals("")

|| credit.equals("") || noOfAssessmentsStr.equals("")) {

JOptionPane.showMessageDialog(null, "Empty Textfield. fill up all the


fields.",

"Empty Textfields", 2);

return;

} else {

if (listing.isEmpty() == true) {

flag = true;

} else {

for (Course aC : listing) {

if (aC.getCourseId().equalsIgnoreCase(courseID)) {

JOptionPane.showMessageDialog(null, "You have added


the same course.",

"Duplicate Course", 2);

return;

} else {

flag = true;

51 | P a g e
SUMAN BHANDARI
try {

duration = Integer.parseInt(durationStr);

} catch (NumberFormatException nFE) {

JOptionPane.showMessageDialog(null, "Pass the numeric value in


duration fields.",

"Numeric Error", 0);

return;

try {

noOfAssessments = Integer.parseInt(noOfAssessmentsStr);

} catch (NumberFormatException nFE) {

JOptionPane.showMessageDialog(null,

"Pass the numeric value in number of Assessments fields.",


"Numeric Error", 0);

return;

if (flag == true) {

listing.add(new AcademicCourse(courseID, courseName,


duration, level, credit,

noOfAssessments));

JOptionPane.showMessageDialog(null,

courseID + " is added in the Academic Course successfully.",


"Added",

52 | P a g e
SUMAN BHANDARI
JOptionPane.INFORMATION_MESSAGE);

return;

});

addAcf.add(addbuttonAC);

addbuttonRegisterAC = new JButton("Register");

addbuttonRegisterAC.setBounds(390, 265, 130, 40);

addbuttonRegisterAC.setFocusable(false);

addbuttonRegisterAC.setForeground(Color.WHITE);

addbuttonRegisterAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

addbuttonRegisterAC.setBackground(Color.RED);

addbuttonRegisterAC.setOpaque(true);

addbuttonRegisterAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

addAcf.dispose();

registerAcademicCourse();

});

addAcf.add(addbuttonRegisterAC);

53 | P a g e
SUMAN BHANDARI
addbuttonClearAC = new JButton("Clear");

addbuttonClearAC.setBounds(173, 325, 130, 40);

addbuttonClearAC.setFocusable(false);

addbuttonClearAC.setForeground(Color.WHITE);

addbuttonClearAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

addbuttonClearAC.setBackground(Color.RED);

addbuttonClearAC.setOpaque(true);

addbuttonClearAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

addAcademicCourseIDTF.setText("");

addAcademicCourseNameTF.setText("");

addAcademicDurationTF.setText("");

addAcademicLevelTF.setText("");

addAcademicCreditTF.setText("");

addAcademicNo_of_AssessmentsTF.setText("");

});

addAcf.add(addbuttonClearAC);

addbuttonCancelAC = new JButton("Cancel");

addbuttonCancelAC.setBounds(390, 325, 130, 40);

addbuttonCancelAC.setFocusable(false);

addbuttonCancelAC.setForeground(Color.WHITE);

addbuttonCancelAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

54 | P a g e
SUMAN BHANDARI
addbuttonCancelAC.setBackground(Color.RED);

addbuttonCancelAC.setOpaque(true);

addbuttonCancelAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

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);

public void registerAcademicCourse() {

registerAcf = new JFrame("INGCOLLEGE");

registerlabelAcademicTitle = new JLabel("Register Academic Course");

registerlabelAcademicTitle.setBounds(250, 10, 300, 50);

registerlabelAcademicTitle.setFont(new FontUIResource("Times New Roman",


Font.BOLD, 23));

55 | P a g e
SUMAN BHANDARI
registerlabelAcademicTitle.setForeground(Color.BLACK);

registerAcf.add(registerlabelAcademicTitle);

registerlabelCourseID = new JLabel("Course ID:");

registerlabelCourseID.setBounds(72, 71, 100, 50);

registerlabelCourseID.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));

registerlabelCourseID.setForeground(Color.BLUE);

registerAcademicCourseIDTF = new JTextField();

registerAcademicCourseIDTF.setBounds(150, 86, 200, 25);

registerAcademicCourseIDTF.setBorder(BorderFactory.createLineBorder(Color.light
Gray, 2));

registerAcf.add(registerAcademicCourseIDTF);

registerAcf.add(registerlabelCourseID);

registerlabelAcademicCourseLeader = new JLabel("Course Leader:");

registerlabelAcademicCourseLeader.setBounds(360, 71, 150, 50);

registerlabelAcademicCourseLeader.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

registerlabelAcademicCourseLeader.setForeground(Color.BLUE);

registerAcademicCourseLeaderTF = new JTextField();

registerAcademicCourseLeaderTF.setBounds(470, 86, 200, 25);

registerAcf.add(registerAcademicCourseLeaderTF);

registerAcf.add(registerlabelAcademicCourseLeader);

56 | P a g e
SUMAN BHANDARI
registerlabelAcademicLecturerName = new JLabel("Lecturer Name:");

registerlabelAcademicLecturerName.setBounds(37, 130, 130, 50);

registerlabelAcademicLecturerName.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

registerlabelAcademicLecturerName.setForeground(Color.BLUE);

registerAcademicLecturerNameTF = new JTextField();

registerAcademicLecturerNameTF.setBounds(150, 145, 200, 25);

registerAcf.add(registerAcademicLecturerNameTF);

registerAcf.add(registerlabelAcademicLecturerName);

registerlabelAcademicStartDate = new JLabel("Start Date:");

registerlabelAcademicStartDate.setBounds(383, 130, 100, 50);

registerlabelAcademicStartDate.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));

registerlabelAcademicStartDate.setForeground(Color.BLUE);

registerAcademicStartDateTF = new JTextField();

registerAcademicStartDateTF.setBounds(470, 145, 200, 25);

registerAcf.add(registerAcademicStartDateTF);

registerAcf.add(registerlabelAcademicStartDate);

registerlabelAcademicCompletionDate = new JLabel("Completion Date:");

registerlabelAcademicCompletionDate.setBounds(170, 200, 150, 50);

registerlabelAcademicCompletionDate.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

57 | P a g e
SUMAN BHANDARI
registerlabelAcademicCompletionDate.setForeground(Color.BLUE);

registerAcademicCompletionDateTF = new JTextField();

registerAcademicCompletionDateTF.setBounds(290, 215, 200, 25);

registerAcf.add(registerAcademicCompletionDateTF);

registerAcf.add(registerlabelAcademicCompletionDate);

registerACDisplayButton = new JButton("Display");

registerACDisplayButton.setBounds(173, 265, 130, 40);

registerACDisplayButton.setFocusable(false);

registerACDisplayButton.setFont(new Font("Monospace", Font.BOLD, 15));

registerACDisplayButton.setBackground(Color.RED);

registerACDisplayButton.setOpaque(true);

registerACDisplayButton.setForeground(Color.WHITE);

registerACDisplayButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

registerAcf.dispose();

displayAcademicCourse();

});

registerAcf.add(registerACDisplayButton);

registerbuttonAC = new JButton("Register");

registerbuttonAC.setBounds(390, 265, 130, 40);

58 | P a g e
SUMAN BHANDARI
registerbuttonAC.setFocusable(false);

registerbuttonAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

registerbuttonAC.setBackground(Color.RED);

registerbuttonAC.setOpaque(true);

registerbuttonAC.setForeground(Color.WHITE);

registerbuttonAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String courseID = getRegisterAcademicCourseIDTF();

String courseLeader = getRegisterAcademicCourseLeaderTF();

String lecturerName = getRegisterAcademicLecturerNameTF();

String startDate = getRegisterAcademicStartDateTF();

String completionDate = getRegisterAcademicCompletionDateTF();

boolean flag = false;

if (courseID.equals("") || courseLeader.equals("") ||
lecturerName.equals("")

|| startDate.equals("") || completionDate.equals("")) {

JOptionPane.showMessageDialog(null, "Empty TextField. Fill up the


fields.!", "Empty Textfield",

2);

return;

} else {

if (listing.isEmpty() == true) {

59 | P a g e
SUMAN BHANDARI
JOptionPane.showMessageDialog(null, "Add the course before the
course register.",

"ArrayList Empty", 2);

return;

} else {

for (Course courseRtr : listing) {

if (courseRtr.getCourseId().equalsIgnoreCase(courseID)) {

if (courseRtr instanceof AcademicCourse) {

AcademicCourse aC = (AcademicCourse) courseRtr;

if (aC.getIsRegistered() == true) {

JOptionPane.showMessageDialog(null, "Course is
registered already.",

"Already Registered", 2);

return;

} else {

aC.register(courseLeader, lecturerName, startDate,


completionDate);

JOptionPane.showMessageDialog(null, "New Course


is registered.",

"New Register Course",


JOptionPane.INFORMATION_MESSAGE);

return;

} else {

60 | P a g e
SUMAN BHANDARI
flag = true;

if (flag == true) {

JOptionPane.showMessageDialog(null, "Academic Course


isnot identified.",

"Identification", JOptionPane.WARNING_MESSAGE);

return;

});

registerAcf.add(registerbuttonAC);

registerclearACButton = new JButton("Clear");

registerclearACButton.setBounds(173, 325, 130, 40);

registerclearACButton.setFocusable(false);

registerclearACButton.setBackground(Color.RED);

registerclearACButton.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

registerclearACButton.setOpaque(true);

registerclearACButton.setForeground(Color.WHITE);

61 | P a g e
SUMAN BHANDARI
registerclearACButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

registerAcademicCourseIDTF.setText("");

registerAcademicCourseLeaderTF.setText("");

registerAcademicLecturerNameTF.setText("");

registerAcademicStartDateTF.setText("");

registerAcademicCompletionDateTF.setText("");

});

registerAcf.add(registerclearACButton);

registerACCancelButton = new JButton("Cancel");

registerACCancelButton.setBounds(390, 325, 130, 40);

registerACCancelButton.setFocusable(false);

registerACCancelButton.setBackground(Color.RED);

registerACCancelButton.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

registerACCancelButton.setOpaque(true);

registerACCancelButton.setForeground(Color.WHITE);

registerACCancelButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

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);

public void displayAcademicCourse() {

displayAcf = new JFrame("INGCOLLGE");

displaylavelAcademicTitle = new JLabel("Display Details");

displaylavelAcademicTitle.setBounds(270, 10, 220, 50);

displaylavelAcademicTitle.setFont(new FontUIResource("Times New Roman",


Font.BOLD, 23));

displaylavelAcademicTitle.setForeground(Color.BLACK);

displayAcf.add(displaylavelAcademicTitle);

displaylabelcademicCourseID = new JLabel("Course ID:");

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);

displayAcademicCourseIDTF = new JTextField();

displayAcademicCourseIDTF.setBounds(120, 125, 200, 25);

displayAcf.add(displayAcademicCourseIDTF);

displayAcf.add(displaylabelcademicCourseID);

txtAreaDplayAcCourse = new JTextArea();

txtAreaDplayAcCourse.setBounds(100, 200, 500, 200);

displayAcf.add(txtAreaDplayAcCourse);

displayDisplayAButton = new JButton("Display");

displayDisplayAButton.setBounds(400, 120, 130, 40);

displayDisplayAButton.setFocusable(false);

displayDisplayAButton.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

displayDisplayAButton.setBackground(Color.RED);

displayDisplayAButton.setOpaque(true);

displayDisplayAButton.setForeground(Color.WHITE);

displayDisplayAButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String courseID = getAddAcademicCourseIDTF();

64 | P a g e
SUMAN BHANDARI
boolean flag = false;

if (listing.isEmpty() == true) {

flag = true;

} else {

for (Course courseDplay : listing) {

if (courseDplay.getCourseId().equalsIgnoreCase(courseID)) {

if (courseDplay instanceof AcademicCourse) {

AcademicCourse aF = (AcademicCourse) courseDplay;

if (aF.getIsRegistered() == true) {

aF.display();

txtAreaDplayAcCourse.setText("Course ID : " +
getAddAcademicCourseIDTF()

+ "\nCourse Name : " +


getAddAcademicCourseNameTF()

+ "\nCredit : " + getAddAcademicCreditTF() +


"\nDuration : "

+ getAddAcademicDurationTextField() + "\nLevel :
"

+ getAddAcademicLevelTF() +
"\nNo_Of_Assessments : "

+ getAddAcademicNo_Of_AssessmentsTF());

return;

65 | P a g e
SUMAN BHANDARI
} else {

flag = true;

if (flag == true) {

JOptionPane.showMessageDialog(null, "Course isnot identified",


"Identification", 2);

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
}

public void addNonAcademicCourse() {

addNAcCF = new JFrame("INGWorld");

addNonActitLabel = new JLabel("Non-Academic Course");

addNonActitLabel.setForeground(Color.BLACK);

addNonActitLabel.setFont(new FontUIResource("Times New Roman",


Font.BOLD, 23));

addNonActitLabel.setBounds(230, 10, 300, 50);

addNAcCF.add(addNonActitLabel);

addLabelNonAcademicCourseID = new JLabel("Course ID:");

addLabelNonAcademicCourseID.setForeground(Color.BLUE);

addLabelNonAcademicCourseID.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));

addLabelNonAcademicCourseID.setBounds(40, 71, 100, 50);

addNonAcademicCourseIDTF = new JTextField();

addNonAcademicCourseIDTF.setBounds(120, 86, 200, 25);

addNAcCF.add(addNonAcademicCourseIDTF);

addNAcCF.add(addLabelNonAcademicCourseID);

addLabelNonAcademicCourseName = new JLabel("Course Name:");

addLabelNonAcademicCourseName.setBounds(330, 71, 120, 50);

67 | P a g e
SUMAN BHANDARI
addLabelNonAcademicCourseName.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

addLabelNonAcademicCourseName.setForeground(Color.BLUE);

addNonAcademicCourseNameTF = new JTextField();

addNonAcademicCourseNameTF.setBounds(440, 86, 200, 25);

addNAcCF.add(addNonAcademicCourseNameTF);

addNAcCF.add(addLabelNonAcademicCourseName);

addLabelNonAcademicDuration = new JLabel("Duration:");

addLabelNonAcademicDuration.setBounds(52, 130, 100, 50);

addLabelNonAcademicDuration.setFont(new FontUIResource("Monospace",
Font.BOLD, 14));

addLabelNonAcademicDuration.setForeground(Color.BLUE);

addNonAcademicDurationTF = new JTextField();

addNonAcademicDurationTF.setBounds(120, 145, 200, 25);

addNAcCF.add(addNonAcademicDurationTF);

addNAcCF.add(addLabelNonAcademicDuration);

addLabelNonAcademicPrerequisite = new JLabel("Prerequisite:");

addLabelNonAcademicPrerequisite.setBounds(340, 130, 100, 50);

addLabelNonAcademicPrerequisite.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

addLabelNonAcademicPrerequisite.setForeground(Color.BLUE);

addNonAcademicPrerequisiteTF = new JTextField();

addNonAcademicPrerequisiteTF.setBounds(440, 145, 200, 25);

68 | P a g e
SUMAN BHANDARI
addNAcCF.add(addNonAcademicPrerequisiteTF);

addNAcCF.add(addLabelNonAcademicPrerequisite);

addButtonNAC = new JButton("Add");

addButtonNAC.setBounds(173, 265, 130, 40);

addButtonNAC.setFocusable(false);

addButtonNAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

addButtonNAC.setBackground(Color.RED);

addButtonNAC.setOpaque(true);

addButtonNAC.setForeground(Color.WHITE);

addButtonNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String courseID = getAddNonAcademicCourseIDTF();

String courseName = getAddNonAcademicCourseNameTF();

String durationStr = getAddNonAcademicDurationTF();

String prerequisite = getAddNonAcademicPrerequisiteTF();

int duration;

boolean flag = false;

if (courseID.equals("") || courseName.equals("") || durationStr.equals("")

|| prerequisite.equals("")) {

69 | P a g e
SUMAN BHANDARI
JOptionPane.showMessageDialog(null, "Empty Textfield. fill up all the
fields.",

"Empty Textfields", 2);

return;

} else {

if (listing.isEmpty() == true) {

flag = true;

} else {

for (Course course : listing) {

if (course.getCourseId().equalsIgnoreCase(courseID)) {

JOptionPane.showMessageDialog(null, "You have added


the same CourseID.",

"Duplicate CourseID", 2);

return;

} else {

flag = true;

try {

duration = Integer.parseInt(durationStr);

} catch (NumberFormatException nE) {

JOptionPane.showMessageDialog(null, "Pass the numeric value in


the duration fields.",

70 | P a g e
SUMAN BHANDARI
"Numeric Error", JOptionPane.ERROR_MESSAGE);

return;

if (flag == true) {

listing.add(new NonAcademicCourse(courseID, courseName,


duration, prerequisite));

JOptionPane.showMessageDialog(null,

courseID + " is added in the Non-Academic Course


successfully", " Added",

JOptionPane.INFORMATION_MESSAGE);

return;

});

addNAcCF.add(addButtonNAC);

addButtonRegisterNAC = new JButton("Register");

addButtonRegisterNAC.setBounds(390, 265, 130, 40);

addButtonRegisterNAC.setFocusable(false);

addButtonRegisterNAC.setForeground(Color.WHITE);

addButtonRegisterNAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

addButtonRegisterNAC.setBackground(Color.RED);

addButtonRegisterNAC.setOpaque(true);

71 | P a g e
SUMAN BHANDARI
addButtonRegisterNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

addNAcCF.dispose();

registerNonAcademicCourse();

});

addNAcCF.add(addButtonRegisterNAC);

addButtonClearNAC = new JButton("Clear");

addButtonClearNAC.setBounds(173, 325, 130, 40);

addButtonClearNAC.setFocusable(false);

addButtonClearNAC.setForeground(Color.WHITE);

addButtonClearNAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

addButtonClearNAC.setBackground(Color.RED);

addButtonClearNAC.setOpaque(true);

addButtonClearNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

addNonAcademicCourseIDTF.setText("");

addNonAcademicCourseNameTF.setText("");

addNonAcademicDurationTF.setText("");

addNonAcademicPrerequisiteTF.setText("");

72 | P a g e
SUMAN BHANDARI
});

addNAcCF.add(addButtonClearNAC);

addButtonCancelNAC = new JButton("Cancel");

addButtonCancelNAC.setBounds(390, 325, 130, 40);

addButtonCancelNAC.setFocusable(false);

addButtonCancelNAC.setForeground(Color.WHITE);

addButtonCancelNAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

addButtonCancelNAC.setBackground(Color.RED);

addButtonCancelNAC.setOpaque(true);

addButtonCancelNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

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
}

public void registerNonAcademicCourse() {

registerNAcCF = new JFrame("INGWorld");

registerlabelNonAcademicTitle = new JLabel("Register Non-Academic


Course");

registerlabelNonAcademicTitle.setBounds(250, 10, 300, 50);

registerlabelNonAcademicTitle.setFont(new FontUIResource("Times New


Roman", Font.BOLD, 23));

registerlabelNonAcademicTitle.setForeground(Color.BLACK);

registerNAcCF.add(registerlabelNonAcademicTitle);

registerLabelNonAcademicCourseID = new JLabel("Course ID:");

registerLabelNonAcademicCourseID.setBounds(72, 71, 100, 50);

registerLabelNonAcademicCourseID.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

registerLabelNonAcademicCourseID.setForeground(Color.BLUE);

registerNonAcademicCourseIDTF = new JTextField();

registerNonAcademicCourseIDTF.setBounds(150, 86, 200, 25);

registerNAcCF.add(registerNonAcademicCourseIDTF);

registerNAcCF.add(registerLabelNonAcademicCourseID);

registerLabelNonAcademicCourseLeader = new JLabel("Course Leader:");

registerLabelNonAcademicCourseLeader.setBounds(360, 71, 150, 50);

74 | P a g e
SUMAN BHANDARI
registerLabelNonAcademicCourseLeader.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

registerLabelNonAcademicCourseLeader.setForeground(Color.BLUE);

registerNonAcademicCourseLeaderTF = new JTextField();

registerNonAcademicCourseLeaderTF.setBounds(470, 86, 200, 25);

registerNAcCF.add(registerNonAcademicCourseLeaderTF);

registerNAcCF.add(registerLabelNonAcademicCourseLeader);

registerLabelNonAcademicInstructorName = new JLabel("Instructor Name:");

registerLabelNonAcademicInstructorName.setBounds(37, 130, 130, 50);

registerLabelNonAcademicInstructorName.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

registerLabelNonAcademicInstructorName.setForeground(Color.BLUE);

registerNonAcademicInstructorNameTF = new JTextField();

registerNonAcademicInstructorNameTF.setBounds(150, 145, 200, 25);

registerNAcCF.add(registerNonAcademicInstructorNameTF);

registerNAcCF.add(registerLabelNonAcademicInstructorName);

registerLabelNonAcademicStartDate = new JLabel("Start Date:");

registerLabelNonAcademicStartDate.setBounds(383, 130, 100, 50);

registerLabelNonAcademicStartDate.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

registerLabelNonAcademicStartDate.setForeground(Color.BLUE);

registerNonAcademicStartDateTF = new JTextField();

registerNonAcademicStartDateTF.setBounds(470, 145, 200, 25);

75 | P a g e
SUMAN BHANDARI
registerNAcCF.add(registerNonAcademicStartDateTF);

registerNAcCF.add(registerLabelNonAcademicStartDate);

registerLabelNonAcademicCompletionDate = new JLabel("Completion Date:");

registerLabelNonAcademicCompletionDate.setBounds(37, 200, 150, 50);

registerLabelNonAcademicCompletionDate.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

registerLabelNonAcademicCompletionDate.setForeground(Color.BLUE);

registerNonAcademicCompletionDateTF = new JTextField();

registerNonAcademicCompletionDateTF.setBounds(150, 215, 200, 25);

registerNAcCF.add(registerNonAcademicCompletionDateTF);

registerNAcCF.add(registerLabelNonAcademicCompletionDate);

registerLabelNonAcademicExamDate = new JLabel("Exam Date:");

registerLabelNonAcademicExamDate.setBounds(380, 200, 100, 50);

registerLabelNonAcademicExamDate.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

registerLabelNonAcademicExamDate.setForeground(Color.BLUE);

registerNonAcademicExamDateTF = new JTextField();

registerNonAcademicExamDateTF.setBounds(470, 215, 200, 25);

registerNAcCF.add(registerNonAcademicExamDateTF);

registerNAcCF.add(registerLabelNonAcademicExamDate);

registerButtonDisplayNAC = new JButton("Display");

registerButtonDisplayNAC.setBounds(173, 265, 130, 40);

76 | P a g e
SUMAN BHANDARI
registerButtonDisplayNAC.setFocusable(false);

registerButtonDisplayNAC.setFont(new Font("Monospace", Font.BOLD, 15));

registerButtonDisplayNAC.setBackground(Color.RED);

registerButtonDisplayNAC.setOpaque(true);

registerButtonDisplayNAC.setForeground(Color.WHITE);

registerButtonDisplayNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

registerNAcCF.dispose();

removeNonAcademicCourse();

});

registerNAcCF.add(registerButtonDisplayNAC);

registerButtonRegisterNAC = new JButton("Register");

registerButtonRegisterNAC.setBounds(390, 265, 130, 40);

registerButtonRegisterNAC.setFocusable(false);

registerButtonRegisterNAC.setFont(new Font("Comic Sans Ms", Font.BOLD,


15));

registerButtonRegisterNAC.setBackground(Color.RED);

registerButtonRegisterNAC.setOpaque(true);

registerButtonRegisterNAC.setForeground(Color.WHITE);

registerButtonRegisterNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

77 | P a g e
SUMAN BHANDARI
String courseID = getRegisterNonAcademicCourseIDTF();

String courseLeader = getRegisterNonAcademicCourseLeaderTF();

String instructorName = getRegisterNonAcademicInstructorNameTF();

String startDate = getRegisterNonAcademicStartDateTF();

String completionDate = getRegisterNonAcademicCompletionDateTF();

String examDate = getRegisterNonAcademicExamDateTF();

boolean flag = false;

if (courseID.equals("") || courseLeader.equals("") ||
instructorName.equals("")

|| startDate.equals("") || completionDate.equals("") ||
examDate.equals("")) {

JOptionPane.showMessageDialog(null, "Empty TextField. Fill up the


fields.!", "Empty Textfield",

2);

return;

} else {

if (listing.isEmpty() == true) {

JOptionPane.showMessageDialog(null, "Add the course before the


course register.",

"ArrayList Empty", 2);

return;

} else {

for (Course courseRtr : listing) {

78 | P a g e
SUMAN BHANDARI
if (courseRtr.getCourseId().equalsIgnoreCase(courseID)) {

if (courseRtr instanceof NonAcademicCourse) {

NonAcademicCourse aC = (NonAcademicCourse)
courseRtr;

if (aC.isRegistered() == true) {

JOptionPane.showMessageDialog(null, "Course is
registered already.",

"Already Registered", 2);

return;

} else {

aC.register(courseLeader, instructorName, startDate,


completionDate,

examDate);

JOptionPane.showMessageDialog(null, "New Course


is registered.",

"New Register Course",


JOptionPane.INFORMATION_MESSAGE);

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 = new JButton("Clear");

registerButtonClearNAC.setBounds(173, 325, 130, 40);

registerButtonClearNAC.setFocusable(false);

registerButtonClearNAC.setBackground(Color.RED);

registerButtonClearNAC.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));

registerButtonClearNAC.setOpaque(true);

registerButtonClearNAC.setForeground(Color.WHITE);

registerButtonClearNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

registerNonAcademicCourseIDTF.setText("");

80 | P a g e
SUMAN BHANDARI
registerNonAcademicCourseLeaderTF.setText("");

registerNonAcademicInstructorNameTF.setText("");

registerNonAcademicStartDateTF.setText("");

registerNonAcademicCompletionDateTF.setText("");

registerNonAcademicExamDateTF.setText("");

});

registerNAcCF.add(registerButtonClearNAC);

registerButtonCancelNAC = new JButton("Cancel");

registerButtonCancelNAC.setBounds(390, 325, 130, 40);

registerButtonCancelNAC.setFocusable(false);

registerButtonCancelNAC.setBackground(Color.RED);

registerButtonCancelNAC.setFont(new Font("Comic Sans Ms", Font.BOLD,


15));

registerButtonCancelNAC.setOpaque(true);

registerButtonCancelNAC.setForeground(Color.WHITE);

registerButtonCancelNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

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);

public void removeNonAcademicCourse() {

removeNonAcCF = new JFrame("INGWorld");

removeNonAcademicTitleLabel = new JLabel("Display Details");

removeNonAcademicTitleLabel.setBounds(270, 10, 220, 50);

removeNonAcademicTitleLabel.setFont(new FontUIResource("Times New


Roman", Font.BOLD, 23));

removeNonAcademicTitleLabel.setForeground(Color.BLACK);

removeNonAcCF.add(removeNonAcademicTitleLabel);

removeLabelNonAcademicCourseID = new JLabel("Course ID:");

removeLabelNonAcademicCourseID.setBounds(40, 110, 100, 50);

removeLabelNonAcademicCourseID.setFont(new
FontUIResource("Monospace", Font.BOLD, 14));

82 | P a g e
SUMAN BHANDARI
removeLabelNonAcademicCourseID.setForeground(Color.BLUE);

removeNonAcademicCourseIDTF = new JTextField();

removeNonAcademicCourseIDTF.setBounds(120, 125, 200, 25);

removeNonAcCF.add(displayAcademicCourseIDTF);

removeNonAcCF.add(removeLabelNonAcademicCourseID);

txtAreaDplayNonAcCourse = new JTextArea();

txtAreaDplayNonAcCourse.setBounds(100, 200, 500, 200);

removeNonAcCF.add(txtAreaDplayNonAcCourse);

removeButtonDisplayNAC = new JButton("Display");

removeButtonDisplayNAC.setBounds(400, 120, 130, 40);

removeButtonDisplayNAC.setFocusable(false);

removeButtonDisplayNAC.setFont(new Font("Comic Sans Ms", Font.BOLD,


15));

removeButtonDisplayNAC.setBackground(Color.RED);

removeButtonDisplayNAC.setOpaque(true);

removeButtonDisplayNAC.setForeground(Color.WHITE);

removeButtonDisplayNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String courseID = getAddNonAcademicCourseIDTF();

boolean flag = false;

83 | P a g e
SUMAN BHANDARI
if (listing.isEmpty() == true) {

flag = true;

} else {

for (Course courseDplay : listing) {

if (courseDplay.getCourseId().equalsIgnoreCase(courseID)) {

if (courseDplay instanceof NonAcademicCourse) {

NonAcademicCourse aF = (NonAcademicCourse)
courseDplay;

if (aF.isRegistered() == true) {

aF.display();

txtAreaDplayNonAcCourse.setText("Course ID : "

+ getAddNonAcademicCourseIDTF() + "\nCourse
Name : "

+ getAddNonAcademicCourseNameTF() +
"\nCredit : "

+ getAddAcademicCreditTF() + "\nDuration : "

+ getAddNonAcademicDurationTF() +
"\nPrerequisite : "

+ getAddNonAcademicPrerequisiteTF());

return;

} else {

flag = true;

84 | P a g e
SUMAN BHANDARI
}

if (flag == true) {

JOptionPane.showMessageDialog(null, "Course isnot identified",


"Identification", 2);

return;

});

removeNonAcCF.add(removeButtonDisplayNAC);

removeButtonRemoveNAC = new JButton("Display");

removeButtonRemoveNAC.setBounds(400, 200, 130, 40);

removeButtonRemoveNAC.setFocusable(false);

removeButtonRemoveNAC.setFont(new Font("Comic Sans Ms", Font.BOLD,


15));

removeButtonRemoveNAC.setBackground(Color.RED);

removeButtonRemoveNAC.setOpaque(true);

removeButtonRemoveNAC.setForeground(Color.WHITE);

85 | P a g e
SUMAN BHANDARI
removeButtonRemoveNAC.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String courseID = getAddNonAcademicCourseIDTF();

boolean flag = false;

if (listing.isEmpty() == true) {

JOptionPane.showMessageDialog(null, "Array list is empty.", "Empty",


2);

return;

} else {

for (Course courseRm : listing) {

if (courseRm.getCourseId().equalsIgnoreCase(courseID)) {

if (courseRm instanceof NonAcademicCourse) {

NonAcademicCourse course = (NonAcademicCourse)


courseRm;

if (course.isRemoved() == true) {

JOptionPane.showMessageDialog(null, " Course is


already removed.", "Removed Course", 1);

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) {

JOptionPane.showMessageDialog(null, " Course is not identified.",


"Identification", 2);

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);

public static void main(String[] args) {

INGWorld abc = new INGWorld();

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

You might also like