Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description Given a file patients.txt of the following format. Assume that the file resides in the current directory of NetBeans. (Right click on your

image text in transcribedimage text in transcribedimage text in transcribed

Problem Description Given a file patients.txt of the following format. Assume that the file resides in the current directory of NetBeans. (Right click on your Project (Coffee lcon) >> New >> Empty File). The patient id is unique (must not repeat) #patient id, first name, last name, year of birth, mobile, address-city, Blood 2018-012, Ali, Salim, 2010, 055-123-1233, al ain A 2018-024, Alia, Ahmad, 1980, 050-543-4555, Dubai, AB 2017-033, Ola, Nasir, 1976, 0556-123-1430, Zayed city, B 2019-024, Sally, Ahmad, 2018, 050-543-4555, Dubai,B 2011-322, Jasim, Saeed, 2012, 055-322-3222, Al ain,O 2013-432,Nora,Ahmad,2011,050-543-4555, dubai, A 1. Write a program in Java to do the following. (50 pts) Keep tracks of the list of patients above in a file called patients.txt. The program has main menu as follows a. b. My Application Menu List all patients' information List all patients in a given city explanation 1. 2. Input: User enters a city Output: information of all patients from that city are displayed Search a patient by his/her name nput: User enters the name Output: all patients whose first or last name contains the keyword entered are displayed Input: None Output: Assume age category Child (age 16 yrs) Input: User enters id, first name, last, name, etc Output: confirmation message of whether addition was successful or not. Make sure not to repeat patient id Input: Program prompts the user to enter patient id Output: Confirmation message whether the removal was successful or not 4 List patient categories 5. Add new patient 6 Remove a patient by id 7. List each family (assume each Input: mobile name family is identified by phone).Output: all patients in information with the given mobile. Input: patient ID, new mobile, new city Output: confirmation message Input: blood type Output: all patients who can donate blood. A gives A and AB B gives B and AB O gives all AB gives AB 8. Update Patient Address 9. Candidate Blood Donors 0. Exit the program Write separate method for each menu item and incorporate the code accordingly. If a new patient is added/removed then it must persist in the text file too. c. d. Used Classes: lnteger.parselnt, Double.parseDouble, String.split, indexOf, charAt, substring,) Scanner, PrintWriter, File, Appendix A Algorithms of selected questions ltem1: List patients' info Input Static Arrays defined: arr1, arr2,... Assumption: All records are read in the arrays. Steps 1. 2. 3. 4. Set index I to 0 Print the element of each array defined Increment J by 1 Go to step 2 if you have not reached the end of the array. Read Patients Input Steps File Name, an array variable for each field. 1. Open the file using the scanner 2. Set index J to 0. 3. String Lineread using the scanner a line 4. String[] Fields split fields in the line into 7 fields. 5. Populate the field array at index J with the appropriate field in the 6. 7. 8. file Increment J If you have not reached the end of the file, then go to step 3 Done

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions