Coursework 2: Critical Report on GP Surgery Application using Java OOP
VerifiedAdded on 2025/04/22
|7
|1037
|338
AI Summary
Desklib provides past papers and solved assignments for students. This report analyzes object-oriented programming in Java.

COURSEWORK 2: CRITICAL REPORT
Student name-
Registration number-
Student name-
Registration number-
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Table of Contents
Introduction................................................................................................................................3
Concepts of object oriented programming and use in the program -.........................................3
Approach and program design...................................................................................................4
Conclusion..................................................................................................................................6
REFRENCES.............................................................................................................................7
Introduction................................................................................................................................3
Concepts of object oriented programming and use in the program -.........................................3
Approach and program design...................................................................................................4
Conclusion..................................................................................................................................6
REFRENCES.............................................................................................................................7

Introduction
The GP Surgery program has been created on Java. For storing the details of patients and
doctors, ArrayLists have been used. The ArrayLists store objects of the respective type,
patient list stores objects of type “Patient” and doctor list stores objects of type “Doctor”. The
user can choose options from the menu of options provided and the chosen function will then
be executed.
Concepts of object oriented programming and use in the program -
To develop the program on Java the OOP concepts such as classes, objects, abstraction etc.
were studied and then implemented in the best possible way.
Below is a brief on how the concepts were implemented in the program.
Classes: In object-oriented programming many objects of a similar kind can be created and to
define the type of objects, classes are used. A class basically lays out the structure of the
object of its type and the object of that class can also be used to access all methods contained
in it (Medium, 2019). Multiple classes can be created in a program to differentiate the type of
objects that will be used in the future. In the GP Surgery program, three classes have been
created.
1. Main class- It contains the main( ) method which is used to run the program and it
defines the switch cases used. Objects for other class types have been created inside
the main class and are used to access methods from their respective classes.
2. Doctor class- It defines the layout of the object of type doctor and contains a treeMap
which stores some other values.
3. Patient class- The patient class contains all the methods that are used to
add/update/delete the patients in the database. It also contains other functions related
to patients.
Objects: As the name object-oriented programming suggests, objects are the basic elements
of any OOP language. An object is an instance of a class which can be used to store data or
access methods from its respective class. Memory is allocated to a class only when it is
instantiated i.e. when the object of that class is created. In this project, multiple objects have
been created to access the methods from the patient class and doctor class. Example:
Patient patient_obj = new Patient();
patient_obj.addPatient();
Here, an object of type patient has been created to access the method addPatient() from the
patient class.
The GP Surgery program has been created on Java. For storing the details of patients and
doctors, ArrayLists have been used. The ArrayLists store objects of the respective type,
patient list stores objects of type “Patient” and doctor list stores objects of type “Doctor”. The
user can choose options from the menu of options provided and the chosen function will then
be executed.
Concepts of object oriented programming and use in the program -
To develop the program on Java the OOP concepts such as classes, objects, abstraction etc.
were studied and then implemented in the best possible way.
Below is a brief on how the concepts were implemented in the program.
Classes: In object-oriented programming many objects of a similar kind can be created and to
define the type of objects, classes are used. A class basically lays out the structure of the
object of its type and the object of that class can also be used to access all methods contained
in it (Medium, 2019). Multiple classes can be created in a program to differentiate the type of
objects that will be used in the future. In the GP Surgery program, three classes have been
created.
1. Main class- It contains the main( ) method which is used to run the program and it
defines the switch cases used. Objects for other class types have been created inside
the main class and are used to access methods from their respective classes.
2. Doctor class- It defines the layout of the object of type doctor and contains a treeMap
which stores some other values.
3. Patient class- The patient class contains all the methods that are used to
add/update/delete the patients in the database. It also contains other functions related
to patients.
Objects: As the name object-oriented programming suggests, objects are the basic elements
of any OOP language. An object is an instance of a class which can be used to store data or
access methods from its respective class. Memory is allocated to a class only when it is
instantiated i.e. when the object of that class is created. In this project, multiple objects have
been created to access the methods from the patient class and doctor class. Example:
Patient patient_obj = new Patient();
patient_obj.addPatient();
Here, an object of type patient has been created to access the method addPatient() from the
patient class.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Constructor: These are a type of functions in a class which initializes an object. Similar to
any other method, constructors have a set of statements which are executed when an object is
created. When an object is created using the new() keyword, the constructor is called to
initialize the object or we can say it is called to assign the initial values to that object. The
name of the constructor is similar to that of the class and it can be parameterized as well. For
the GP Surgery program, parameterized constructors for Patient and Doctor class have been
written to assign the values to the objects that are being created (Anzala, 2019). Example of
constructor used in the program:
public Patient (String first_name, String last_name, String email_id,
String Contact, String Date_of_Birth, String Address, int Patient_id, int
PaidFee, String Type_of_member) {
this.first_name=first_name; //Setting value of first name.
this.email_id=email_id;//Setting value of Email id.
this.Date_of_Birth=Date_of_Birth;//Setting value of Date of
Birth.
this.last_name=last_name;//Setting value of Last name.
this.Contact=Contact;//Setting value of Contact Number.
this.Address=Address;//Setting value of Address.
this.Patient_id=Patient_id;//Setting value of Patient's id.
this.PaidFee=PaidFee;//Setting value of Paid Fee.
this.Type_of_member=Type_of_member;//Setting value of Member
Type.
} //Declaring parameterized constructor for patient's class
This Keyword: In Java, this is a special keyword which is used to refer to the current object.
By using this keyword we tend to reduce errors in code due to the naming of variables. In the
above example of constructors, we can see that this keyword is used for each variable that is
created. It actually assigns the passed value to the globally declared variable (Das, 2019)
Example:
In the patient class, variable by the name ‘first_name’ is created and in the Patient constructor
‘f_name’ is being passed. Now, this.first_name actually assigns the passed value in the
constructor call to the globally declared first_name variable.
Approach and program design
 In the developed program, the data for patients and the doctors are being stored in
ArrayLists which are storing objects of that class type. These objects, in turn, contain
all the data of the patients and doctors. ArrayLists have been used over arrays because
we don’t need to pre-define their size like we have to in arrays and this is what makes
ArrayLists dynamic. (JournalDev, 2019)
 TreeMaps have been used to store key-value pairs. In our program appointment time
and the Doctor’s name are the key-value pairs being stored. These TreeMaps help to
retrieve appointment time and other details.
any other method, constructors have a set of statements which are executed when an object is
created. When an object is created using the new() keyword, the constructor is called to
initialize the object or we can say it is called to assign the initial values to that object. The
name of the constructor is similar to that of the class and it can be parameterized as well. For
the GP Surgery program, parameterized constructors for Patient and Doctor class have been
written to assign the values to the objects that are being created (Anzala, 2019). Example of
constructor used in the program:
public Patient (String first_name, String last_name, String email_id,
String Contact, String Date_of_Birth, String Address, int Patient_id, int
PaidFee, String Type_of_member) {
this.first_name=first_name; //Setting value of first name.
this.email_id=email_id;//Setting value of Email id.
this.Date_of_Birth=Date_of_Birth;//Setting value of Date of
Birth.
this.last_name=last_name;//Setting value of Last name.
this.Contact=Contact;//Setting value of Contact Number.
this.Address=Address;//Setting value of Address.
this.Patient_id=Patient_id;//Setting value of Patient's id.
this.PaidFee=PaidFee;//Setting value of Paid Fee.
this.Type_of_member=Type_of_member;//Setting value of Member
Type.
} //Declaring parameterized constructor for patient's class
This Keyword: In Java, this is a special keyword which is used to refer to the current object.
By using this keyword we tend to reduce errors in code due to the naming of variables. In the
above example of constructors, we can see that this keyword is used for each variable that is
created. It actually assigns the passed value to the globally declared variable (Das, 2019)
Example:
In the patient class, variable by the name ‘first_name’ is created and in the Patient constructor
‘f_name’ is being passed. Now, this.first_name actually assigns the passed value in the
constructor call to the globally declared first_name variable.
Approach and program design
 In the developed program, the data for patients and the doctors are being stored in
ArrayLists which are storing objects of that class type. These objects, in turn, contain
all the data of the patients and doctors. ArrayLists have been used over arrays because
we don’t need to pre-define their size like we have to in arrays and this is what makes
ArrayLists dynamic. (JournalDev, 2019)
 TreeMaps have been used to store key-value pairs. In our program appointment time
and the Doctor’s name are the key-value pairs being stored. These TreeMaps help to
retrieve appointment time and other details.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

 All design criterions were fulfilled with the current approach but better design could
have been implemented by using advanced concepts of OOPS and Java.
 We could have used exception handling instead of conditional statements so that the
application could provide better responses in case an error occurs.
 Below are some snippets of the application.
Figure 1: Main class of the program
Figure 2: Main menu of the program
have been implemented by using advanced concepts of OOPS and Java.
 We could have used exception handling instead of conditional statements so that the
application could provide better responses in case an error occurs.
 Below are some snippets of the application.
Figure 1: Main class of the program
Figure 2: Main menu of the program

Figure 3: Patient class of the program
Conclusion
Concepts of OOP were studied and the design criterion was met with the implementation of
the concepts on Java. On the basis of the experience of developing this application, better
design techniques will be used for development of applications in the future.
Conclusion
Concepts of OOP were studied and the design criterion was met with the implementation of
the concepts on Java. On the basis of the experience of developing this application, better
design techniques will be used for development of applications in the future.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

REFERENCES
 JournalDev, 2019. OOPS Concepts in Java - OOPS Concepts Example - JournalDev.
[online] Available at: https://www.journaldev.com/12496/oops-concepts-java-
example [Accessed 15 Mar. 2019].
 Anzala, M., 2019. Basic Concepts of Java Programming. [online] Mrbool. Available
at: http://mrbool.com/basic-concepts-of-java-programming/30152 [Accessed 16 Mar.
2019].
 Medium, 2019. Object-Oriented Programming Concepts “In Simple English”.
[online] Medium. Available at: https://medium.com/@yannmjl/object-oriented-
programming-concepts-in-simple-english-3db22065d7d0 [Accessed 16 Mar. 2019].
 Das, D., 2019. Basic Concept of Object Oriented Programming Language. [online]
CSETutor. Available at: https://www.csetutor.com/basic-concept-of-object-oriented-
programming/ [Accessed 16 Mar. 2019].
 JournalDev, 2019. OOPS Concepts in Java - OOPS Concepts Example - JournalDev.
[online] Available at: https://www.journaldev.com/12496/oops-concepts-java-
example [Accessed 15 Mar. 2019].
 Anzala, M., 2019. Basic Concepts of Java Programming. [online] Mrbool. Available
at: http://mrbool.com/basic-concepts-of-java-programming/30152 [Accessed 16 Mar.
2019].
 Medium, 2019. Object-Oriented Programming Concepts “In Simple English”.
[online] Medium. Available at: https://medium.com/@yannmjl/object-oriented-
programming-concepts-in-simple-english-3db22065d7d0 [Accessed 16 Mar. 2019].
 Das, D., 2019. Basic Concept of Object Oriented Programming Language. [online]
CSETutor. Available at: https://www.csetutor.com/basic-concept-of-object-oriented-
programming/ [Accessed 16 Mar. 2019].
1 out of 7
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.


