Object Oriented Programming in Java: Medicare Booking System Report

Verified

Added on  2022/09/18

|5
|1130
|24
Report
AI Summary
This report details the design, development, and testing of a console-based Medicare booking system implemented in Java, showcasing object-oriented programming (OOP) principles. The project involved creating four classes (Booking, Doctor, Patient, and MediacareBooking) to manage appointment registration, cancellation, doctor schedules, and patient details. The program utilizes a menu-driven interface and a switch statement for user input processing and function redirection. Data storage is managed using linked lists for efficient insertion and retrieval of data, and the report discusses the advantages of using linked lists over arrays. The report also explores the application of inheritance, the considerations for using the switch statement, and the rationale behind design choices. Furthermore, the report also includes a reflection on the project and the use of object-oriented programming concepts. The report also touches on the advantages and disadvantages of using different data structures, such as linked lists versus arrays, and the importance of testing in software development.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Running head: OBJECT ORIENTED PROGRAMMING WITH JAVA
Object Oriented Programming with Java
Name of the Student
Name of the University
Authors note
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
1OBJECT ORIENTED PROGRAMMING WITH JAVA
Reflection
In this programming project, the main objective was to create a console based
program that will be able to register an appointment, cancel a registered appointment. In
addition to that, the program will be able to display the doctor’s schedule as well as patient’s
appointment details.
In order to complete the program, four classes were designed so that the
functionalities can be implemented with the OOPS concept. These classes are Booking,
Doctor, Patient and Finally the MediacareBooking class.
The program presents a menu to the user as the developed program was menu driven.
The choice entered by the user is parsed using the scanner class.
The redirection to the functions according to the user choices are accomplished using
the switch case statement. Through the use of switch statement it is possible to build a multi-
way branch statement to call different functions according to the different user choices. In
this way, this statement provides easy way in order to dispatch execution in different code
blocks depending on the value of the expression entered by the user of the application. The
choice of the user can be char, byte and int data types.
While using the switch case, I found some important points that needs to be
considered;
Duplicate case values in the switch statement is not allowed. In order to send the
execution to a specific code block the duplicate values are not allowed.
Used value or the data type for case needs to be same data type that is used in
switch statement. Along with that, the value for case always should be constant and not a
Document Page
2OBJECT ORIENTED PROGRAMMING WITH JAVA
variable as it will not execute a specific block of depending on the user choice. “Break”
statement must be used in a in order to terminate code sequence.
Even though the break statement considered as but omission of this statement wil
lead to the continuous execution of the codes under next case.
Finally the default statement in the switch case statement is used in order to address
the scenario where none of the case options are selected by the user, then the code segment
under the default segment is executed. After some research I found that this default
command can be used anywhere in switch block. Only consideration that needs to keep in
mind is, if the default command is not at the end, a break statement must be followed after the
default case.
Using the inheritance the data elements and the methods of the patient, doctor and
booking classes are accessed from the MedicareBooing class.
In order to store the data for the booking or patients the Linked List are used. The
linked lists are collection based data structures available in java. These linked lists are very
useful as elements does not requires to be stored in contiguous locations in the memory.
Every element of the linked list is considered as a separate object that contains data part and
address of the next node. The linked list class in java, extends Abstract Sequential List,
implements List interface. Being an ordered collection, the linked list data structure in java
supports duplicate elements stored in it. Furthermore, this data structure stores data according
to the insertion order, can store null elements as well as supports index based operations on
the data elements. Thus for performance and optimized memory utilization, I used the linke
list for this program so that insertion of data as well as retrieval of data for displaying the
records becomes easy.
Document Page
3OBJECT ORIENTED PROGRAMMING WITH JAVA
Different elements of linked lists are connected with each other using pointers or the
address to the next data element often known as nodes. Being dynamic as well as ease of
insertions, deletion operations this data structure is used over the arrays. While moving on to
the next stage, I found that there are few disadvantages of using the linked list. As an
example any node cannot be accessed or retrieved directly rather we have to start from the
head node and then follow the links of the respective nodes in order to reach to the required
node. In java, in order to store the data collection elements in a linked list the doubly linked
list is used that provides linear data structure. In addition to that, it is also helpful in order to
inherit an abstract class or implement a list of objects as well as deque interfaces.
I avoided the use of the array in order to store the details of the doctors, patients and
bookings. The reason behind this can be stated as size of a declared array becomes fixed. In
this scenario the size is predetermined by the developer but as in this project, it is hard to
predict number of elements that will be stored in the memory is not known in advance thus it
is possible that the declared size fall short.
At this point it is not possible to increase the size of the used array. On the other
hand, if a large size array is declared and that much storage is not required for storing the
elements then it will lead to the waste of memory. Moreover, Insertion of an element or node
in the array data structure is considered as performance wise expensive. The reason behind
this is, in order to accommodate an element shifting of the several elements is required in
order to make space for desired new element. On the contrast, the insertion and deletion
operations in Linked list data structure are not that much performance wise expensive as for
both the operations in linked list, it is not required to shift elements. In linked list only pointer
of nodes of current and previous needs to be changed. Furthermore, in Java there are built-in
functions that helps in completing basic linked list operations such as add(), remove(), size()
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
4OBJECT ORIENTED PROGRAMMING WITH JAVA
and so on which helps in insertion, deletion, getting information about the size of the linked
list so that it can know that how many elements are stored in the list.
chevron_up_icon
1 out of 5
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]