Académique Documents
Professionnel Documents
Culture Documents
MODULE CODE INTAKE CODE ASSIGNMENT TITLE SUBMITTED TO HAND IN DATE HAND OUT DATE
: CE00314-2 FPC : HF09B1COM : Further Programming Concepts in C++ : Mr.Udesh Amarasinghe : 27th August 2010 : 2nd November 2010
Acknowledgments
This was a great opportunity for me to put into practice which I learned in few lecturers and my own research knowledge on object oriented programming and C++. First and foremost I would like my sincere graduate to Mr.Udesh Amarasinghe for his great guidance in this project. Finally, I would like to thank each and every person who helped me in numerous ways to make this project a success.
Table of Contents
Assumptions.................................................................................................................... 4 Implementation ................................................................................................................ 5 Class Diagram ................................................................................................................. 6 Object Oriented Concepts ............................................................................................... 7 Classes ........................................................................................................................ 7 Objects ........................................................................................................................ 8 Abstraction ................................................................................................................... 8 Inheritance ................................................................................................................... 9 Polymorphism ............................................................................................................ 10 Static Polymorphism .............................................................................................. 10 Dynamic Polymorphism ......................................................................................... 11 Programming Concepts................................................................................................. 12 User defined data types ............................................................................................. 12 Modularity .................................................................................................................. 12 Decomposition ........................................................................................................... 12 Extendibility ............................................................................................................... 12 Screens ......................................................................................................................... 13 Validations..................................................................................................................... 16 Test Plans ..................................................................................................................... 17 Limitations ..................................................................................................................... 20 References .................................................................................................................... 21
Assumptions
Users of the system are already provided with the usernames and passwords which are required for authentication.
Doctors are supposed to edit or add medical records about any patients. Only administrators are having authorization to edit or add patients payment details.
All the users of this system have a basic knowledge of using computers and experienced in working with console applications.
As this application depends on windows libraries the program will be used in windows platform only.
1.0 Implementation
The implementation of this program should be complete using C++ language and the object oriented concepts. By using object oriented concepts the application can easily extendable, implement new features and have many other benefits. As the first step of the implementation it is required to identity the logical design of the application. Unified modeling language (UML) can be used to model the design of the proposed application. Foremost it is required to identify the user categories that interact with the system. These entities can be identified as Administration staff, doctors, nurses and patients. Next it is required to identity the relationships between the system and the entities for the next stage of implementation. Following to next the attributes of each entity can be identified. Some of the entities may have common attributes, for instance every person who interact with the system may name a name, age and a gender so in this situation these common attributes can be abstracted and create a common entity which can be inherited for the specializations of the entities . Also it is required to keep the data which will be stored in these attributes should be secured. By using proper access modifiers this situation can be overcome. The following diagram shows the class diagram which is a type of a UML diagram, reflects the structure and the relationships of the system.
Administration
Derived class Derived class Derived class Derived class Template class
Support Classes Login Menu GUI Error Handling Authentication and authorization of users Class Class Class Class to the system. Navigate the users in the system. Provide graphics and messages in the console. Keep methods for user input validations.
Table 1 Class Information.
As the above figure the except the major classes the supportive classes provide various functionalities to the system. As an example all the command line interface (CLI) interactions are managed by the menu class and the authenticating and authorizations of the users are done by the login class.
3.2 Objects
All the classes are used in this program as instances of the classes. In the system there may me numerous number of patients, nurses or administrators. In the run time instances on these classes will be used.
3.3 Abstraction
As Cain (2010), real world objects like doctors, Patients may have endless characteristics but as the requirement of the system its need to select the required characteristics likes medical details, allergies and required personal details, selecting the required characteristics as the requirement can be considered as abstraction. Abstraction helps to create a generalize emerge of an entity which can be specialized by inheriting it. In the designed system person is identified as an abstract class which all the users doctors, patients will be inherited from.
3.4 Encapsulation
Encapsulation is a way of protecting data by restricting access to them using access modifiers. According to Balaguruswamy (2008) C++ supports three kinds of encapsulation methods which are private, public and protected. In the deliberate system most of the attributes are defined as private or protected to prevent the unauthorized access. To provide access getter methods and setter methods can be used.
3.5 Inheritance
As Schmidt (n.d) inheritance allows to create classes with specialization classes with extendibility. The advantage of using inheritance is that to reusability of code, save the time and effort of redoing the same work. In this project all the users who use the system are inherits from the person class. Person class contains the basic attributes of a person which are common to all users. The following class shows the inheritance of the classes.
Figure Inheritance
As the above diagram doctor who is an administrative user is inherited from two base classes with multiple inheritances. Multiple inheritances is used because the administrative users may have special features which are only required for administrative personals. As C++ supports multiple inheritances these classes can be easily extended with new features without altering the current code.
3.6.1.1 Overloading
According to Deitel & Deitel (2009) overloading is using multiple methods with same but different arguments. In this project all the classes which are inherit from the person class have overloaded constructor.
3.6.1.2 Overriding
As Deitel & Deitel (2009) describes overriding helps to replicate the similar process in various object types in different ways. The printallInfo() method which inherits from person class to its derived classes provide different operations as the type of the object. In C++ concepts pure virtual functions have been used in the base person class to print all person information.
10
11
4.2 Modularity
Attached to the classes the functionalities of the system are made by modules. These modules are divided logically as can be reused. All the modules which are commonly used are placed in a common class.
4.3 Decomposition
As the problem statement this scenario is logically decomposed in to smaller solutions. This approach will help to solve the main dilemma by solving the smaller problem, in example searching is a solution for a miniature problem but its a part of the main scenario problem.
4.4 Extendibility
As the implementation is based on object oriented concepts so this solution can be easily extendable for new features. Also as the requirement in prospect more attributes can be added to the classes and extend the solution.
12
5.0 Screens
Login Screen
13
14
15
6.0 Validations
Login Validations Without a correct username or password users cannot access the system. Users have to use their authorized usernames and passwords to login into the system.
Record Validations When searching or viewing records the person IDs are validated. If user inputs an invalid ID which not available in the file it will not be accepted.
Gender Validations In registration forms except M for male and F for female any other user input will not be accepted.
Number Validations In payment and other locations where takes user input for numeric values are validated. If user entries a non numeric number it will not be accepted.
Doctor Availability When assigning a doctor to a patient, if doctor is not available in doctor records a warning message will be generated.
Error Messages When error occurs a colorful error message will be promoted to users with the error details and echo notification. Also when an action completed a message will be shown.
16
Login Screen
Login Screen
Login Screen
Kept Blank
Patient added successful message Doesnt accept the user input and a beep message Show the registered patient details
Patient registration
View patients
17
10
Error message and redirect back to main menu Load the create new doctor details Save the doctor details and
11
12
Create Doctor
redirect to the manage staff menu Save the nurse details and
13
Create Nurse
14
Search Staff
Enter a valid staff ID Enter a invalid staff ID Enter a valid patient ID Add medical details Enter valid medical details Enter a valid date
15
Search Staff
16
Search Patients
Show patients information Show the medical details add form Successful message
17
18
19
Successful message
20
21
22
18
Show the patients 23 Patients Login menu payment/and medical details 24 Nurse Menu Enter first password 25 Password Validation and second password matching 26 Password Validation Enter non matching passwords
Table 2 Unit Test Plan
19
Limitations
Extending the application may affect the current stored data in files in file inputoutput operations.
20
References
Balagurusamy (2008), Object Oriented Programming With C++, India: TATA McgrawHill. Cain, J. (2010), Programming Abstractions - CS106B: California: Stanford University. Deitel, H. & Deitel, P. (2009), C++ How to Program, USA: Prentice Hall. Hekmat, S. (n.d), C++ Essentials, PragSoft Corporation. Schmidt (n.d), C++ Programming Language, [Online]. Available from: http://www.cs.wustl.edu/~schmidt/C++/ [Accessed on 31st October 2010 ]. Stroustrup, B. (2000). The C++ Programming Language, UK: Addison-Wesley. Vandervoodrde, D. (2002), C++ Templates: The Complete Guide. Addison-Wesley Professional: Canada.
21