Analyze a problem in an object-oriented manner

Assignment Help JAVA Programming
Reference no: EM131059222

Part -1:

Objectives: The general aims of the assignment, which consists of two parts, are:

- To analyze a problem in an object-oriented manner, and then design and implement an object-oriented solution that conforms to given specifications
- To practise using inheritance in Java
- To practise file input and output in Java
- To make implementations more robust through mechanisms such as exception han- dling.

Problem Description

In this assignment, which consists of two parts, you will develop a prototype of a patient record system.

A medical clinic needs a system to keep information about their patients and medical observations about the patients. The concept of medical observation is explained below.

- Each patient has a unique patient ID and a name. For each patient, various kinds of medical observations are recorded.
- A medical observation can be measurement such as height, weight, blood pressure, etc. These measurements are referred to as "measurement observations".
- In addition, there are observations that are of non-quantitative nature, for example, the patient's blood type. These observations are referred to as "category observa- tions".
- Each observation type has a name (e.g. "Height" , "Blood type") and a unique code.
- Each measurement observation type has a unit associated with it. Each unit is specified by a name.
- Each category observation type has a number of valid categories associated with. Each category of a category observation type is indentified by a name.

The nurses and doctors who use the system should be able to:

- Add a measurement observation type
- Add a category observation type
- Delete an observation type (which has no associated observations)
- Add a patient
- Add a measurement observation (for a patient)
- Add a category observation (for a patient)
- Modify the value for a measurement observation
- Modify the category for a category observation
- Delete an observation (of a patient)
- Delete a patient (delete all the patient's observation as well)
- Retrieve details of an observation type (given its code)
- Retrieve a patient record by the patient id (including the patient's observations)

In addition (though we will not be concerned with these for Part 1), the nurses and doctors should be able to
- Save all the data
- Load data from the file

Task 1 - Implementing all the classes required to validate the design class diagram

As the first step in the implementation process, it is desirable to validate the design class diagram.

Toward this purpose, you are required to

- Implement the classes in the design class diagram: Patient, ObservationType, MeasurementObservationType, CategoryObservationType, Observation, MeasurementObservation and CategoryObservation.
Include all the necessary attributes and methods, which you need to identify
- Implement a class, called PatientRecordSystem, that manages the data of the pa- tients and their records

Operations required to be supported

For the purpose of validating the design, the PatientRecordSystem class should provide the methods to perform the following operations:

1. Add a measurement observation type
2. Add a category observation type
3. Add a patient
4. Add a measurement observation (for a patient)
5. Add a category observation (for a patient)

For testing purpose, as will be required for Task 2, the PatientRecordSystem should also have a toString method to display all the objects stored in the system.

Task 2 - Testing the PatientRecordSystem class

Test your PatientRecordSystem class with the test program provided in the Appendix.

Your classes should be implemented in such a way that the provided test program can be run without any changes.

Try to make the output of the tests easy to read.

Part -2:

Task 1

Implement two methods for the PatientRecordSystem class to save data and to load data.

The first method, with the header public void saveData() throws Exception will save the data to five text files:

- PRS-MeasurementObservationTypes.txt
This file saves the measurement observation types. A sample is shown below:
T100; Blood Pressure; psi T400; Height; cm
Each measurement observation type is on a separate line. It contain the observation type code, name and unit, separated by semi-colons.
- PRS-CategoryObservationTypes.txt
This file saves the category observation types. A sample is shown below:
T200; Blood Type; Group A, Group B1, Group B2 T300; Stress Level; Low, Medium, High
Each category observation type is on a separate line. It contain the observation type code, name and the categories. The three "fields" (code, the name and the categories) are separated by semi-colons. In the categories fields, the categories are separated by commas.
- PRS-Patients.txt
This file saves the patients's data without their observations. A sample is shown below:
P100; John Smith P200; Anna Bell
Each patient is on a separate line. It contain the patient's id and name, separated by a semi- colon.

- PRS-MeasurementObservations.txt
This file saves the patients's measurement observations. A sample is shown below:
P100; T100; 120.0
P200; T400; 180
Each measurement observation is on a separate line. It contain the patient's id, the observation code and the observation value (a double). The fields are separated by semi-colons.
- PRS-CategoryObservations.txt
This file saves the patients's category observations. A sample is shown below:
P100; T200; Group A P200; T300; Low
Each category observation is on a separate line. It contain the patient's id, the observation code and the observation value (a String). The fields are separated by semi-colons.

The second method, with the header
public void loadData() throws Exception
will read the data from five text files and save them in a PatientRecordSystem instance by calling methods to add measurement observation types, category observation types, etc.

The data should be loaded into a PatientRecordSystem instance which is empty of data.

Of course, you may need to enhance other classes to support the implementation of the saveData and loadData methods.

Also, you should write a small program to test your methods. A sample test program is given in the Appendix 1.

As for Part 1, your implementation must be such that the sample test program can be run without any change.

The sample test program is more or less the bare minimum. You should add more test cases to it.

Task 2

Write the menu program, called PatientRecordSystemMenu, to provide options in the following menu:

=====================
Patient Record System
=====================

1. Add a measurement observation type
2. Add a category observation type
3. Add a patient
4. Add a measurement observation
5. Add a category observation
6. Display details of an observation type
7. Display a patient record by the patient id
8. Save data
9. Load data
D. Display all data for inspection
X. Exit
Please enter an option (1-9 or D or X):

The menu program must use the PatientRecordSystem class developed for Task 1.
For each option, the program should ask for the required inputs, each with a separate prompt.
For option 6, 7 and D, it is acceptable just to use the toString methods of the classes involved (which should have been implemented in Part 1 of the assignment).
See Appendix 2 for a short sample run.
The menu program for this task is only required to satisfy the data correctness conditions. It is not required to be robust, i.e. it can crash when certain exceptions occur.

Task 3- Making the Menu Program Robust

Implement a class called RobustPatientRecordSystemMenu, which extends the previous menu and includes enough exception handling features to make it robust. It is required to be robust only in the following sense: when an exception occurs in the execution of an option, the program will display some information about the exception on the screen and return to the main menu.

Task 4. (For CSE4IOO students only)

This task is not related to the Patient Record System. For the purpose of this task, a string is regarded as having the correct syntax for an email if it satisfies the following conditions:
- Condition 1: It is a sequence of lowercase letters, the period character ('.'), and the @
character
- Condition 2: The @ character must appear once and must appear between two letters
- Condition 3; The period character can appear zero or more times, and it must appear between two letters

Write an EmailChecker class, which has methods with headers:

- public static boolean checkCharacters(String email)
which returns true if Condition 1 is satisfied, and false otherwise
- public static boolean checkAt(String email)
which returns true if Condition 2 is satisfied, and false otherwise
- public static boolean checkDot(String email)
which returns true if Condition 3 is satisfied, and false otherwise
- public static boolean checkEmail(String email)
which returns true if the string has the valid format for an email, and false otherwise.

Submit the EmailChecker and a EmailCheckerTestter class.

(The total mark for Part 2 will be 100 for CSE1IOO students and 110 for CSE4IOO students. The percentage of contribution to the final will be the same.)

Reference no: EM131059222

Questions Cloud

Determine force that you need to exert on front : Determine the force that you need to exert on the front of the refrigerator at the start of its tipping. You push horizontally 1.5 m above the floor.
How might one self presentation play role in their behavior : Do you think the strong individual whom steps out of the ranks, still compares themselves to others? What is it about a person or groups of people who step out of the ranks? Explain as this relates to social psychology.
Determine force that you need to exert on front : Determine the force that you need to exert on the front of the refrigerator at the start of its tipping. You push horizontally 1.5 m above the floor.
Determine payback period and accounting rate of return : Terra Networks is planning to buy injection molding machinery costing $180,000. This machinery’s expected useful life is 5 years. They require a minimum rate of return of 8%, and have calculated the following data pertaining to the purchase and opera..
Analyze a problem in an object-oriented manner : CSE1/CSE4IOO - analyze a problem in an object-oriented manner, and then design and implement an object-oriented solution that conforms to given specifications
What real amount must you deposit each year to achieve goal : You want to have $2 million in real dollars in an account when you retire in 40 years. The nominal return on your investment is 10 percent and the inflation rate is 3.8 percent. What real amount must you deposit each year to achieve your goal?
Compute overhead rates using activity-based costing approach : Compute the overhead rates using the activity-based costing approach. (Round answers to 2 decimal places, e.g. $12.25.). Compute the overhead rate using the traditional (plantwide) approach.
Calculate the total common equity balance expected : The firm’s accounts payable were $375,000. Sales in 2013 were $2,500,000, and are expected to increase by 40% in 2014. Recall that current liabilities vary directly with sales. How much in total debt is the firm expecting for the year 2014? Calculate..
What impact has lockheed martins acquisition strategy had : What impact has Lockheed Martin's acquisition strategy had in each of its business segments? What recommendations/proposals can you make for Hewson as she takes the reigns of the company?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Public float usefulload()

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

  To translate infix mathematical expression

Write a program in java to translate infix mathematical expression into postfix expression and a program to evaluate the postfix expression

  Describe the behavior of the java class

The authors initially describe the behavior of the java.util.Hashmap class. As they describe it, the Java implementation of a Hash Map consists of a table (bucket array) of entries. Each entry consists of a K, V pair with the addition of a next re..

  Create a gui client side application that is a java version

q1. create a gui client side application that is a java version of notepad giving the ability to open modify and save

  Writing an applet with graphics in this programming

writing an applet with graphics in this programming activity you will write an applet that uses graphics. you will draw

  Develop the myclone class

You will also create another class of your choice. Your programmer-defined class should have at a minimum two instance variables and one method - You will create a Virtual World application as your final project. This Virtual World will have sever..

  Starting hand gesture for the computer

You will develop a webpage that will allow the user to play Rock- Paper- Scissors against the computer.

  Write method called median that accepts an array of integer

Write a method called median that accepts an array of integers as its parameter and returns the median of the numbers in the array.

  A regular polygon is an n-sided polygon

A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree(i.e the polygon is both equilateral and equiangular).

  Palindrome is a sequence of char that reads backward forwrd

A palindrome is a sequence of characters that reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554, and 11611. Write an application called Palindrome.java that asks the user t..

  Add event handling to the button find out the value the

make a windows program in java that has a labeled text field for the price of a meal. there are different discounts for

  Write a public static method writetokenstolines

Write a public static method called writeTokensToLines that will read an input file one token at a time using Scanner, and write the tokens to a file using a PrintWriter, one token per line, with the tokens numbered starting at 1.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd