Need help with this Java practice project. I'm brand new to coding so javadoc and maybe a
description on what you used in the comments would greatly help.
Must create a medical record using CSV (Comma-Separated Value) files. The software must
include and use the inputPatients(), getPatientList(), updatePatient(), addPatient(), and
outputPatients() methods.
That being said the record has a few key features. It must feature 4 letters, each representing an
option for the code. L-List patients, U-Update patients, A-Add patients, and Q-Quit.
The instructions also include what the program should input incase of errors.
1. If there are not exactly three arguments on the command line, then the following usage
message must be displayed and the program must immediately exit.
2. If the third argument is not an integer that is greater than 0, then the following usage message
must be displayed and the program must immediately exit.
3. If the input file on the command line cannot be accessed, then the following message must be
displayed and the program must immediately exit.
4. If the output file already exists, the user should be asked if it is OK to overwrite the file. If
they answer anything that begins with y or Y, the file should be overwritten. Otherwise, it should
not be overwritten and the program must exit.
My textbook also gave guidelines on how the code should look.
5. If a FileNotFoundException occurs when attempting to open an output file, the program must
output the error message, Cannot create output file and exit.
6. If the input file (a) does not contain seven items on each line as described above, (b) the
patient ids do not start with 1001 and increase by 1 for each patient, (c) the height and/or weight
are not integer values, (d) the temperature is not a double value (note that all integer values are
also double values), or (e) the file contains more lines than the maximum number of patients, the
program must output the error message, Invalid input file and exit.1// Reads each line of the
input file, and stores the patient id, name, birthdate, // height, weight, temperature, and blood
pressure // in the appropriate array parameter 4// Returns true, if successful // Returns false, if 6 //
(a) a line of the file does not contain seven items on each line as described above, 7 (l) (b) the
patient ids do not start with 1001 and increase by 1 for each patient, 8// (c) the height and/or
weight are not integer values, 9 (l) (d) the temperature is not a double value (note that all integer
values are also double values), 0 (e) or the file contains more lines than the maximum number of
patients (note that the length of 1/ each array corresponds to the maximum number of patients)
2/13// Throws an IllegalArgumentException with the message 4// "Null file" if in is null 1/ //
Throws an IllegalArgumentException with the message 8// and/or bloodPressures are/is null 1/ //
Throws an IllegalArgumentException with the message 1// "Invalid array length" if t.
Need help with this Java practice project. Im brand new to coding s.pdf
1. Need help with this Java practice project. I'm brand new to coding so javadoc and maybe a
description on what you used in the comments would greatly help.
Must create a medical record using CSV (Comma-Separated Value) files. The software must
include and use the inputPatients(), getPatientList(), updatePatient(), addPatient(), and
outputPatients() methods.
That being said the record has a few key features. It must feature 4 letters, each representing an
option for the code. L-List patients, U-Update patients, A-Add patients, and Q-Quit.
The instructions also include what the program should input incase of errors.
1. If there are not exactly three arguments on the command line, then the following usage
message must be displayed and the program must immediately exit.
2. If the third argument is not an integer that is greater than 0, then the following usage message
must be displayed and the program must immediately exit.
3. If the input file on the command line cannot be accessed, then the following message must be
displayed and the program must immediately exit.
4. If the output file already exists, the user should be asked if it is OK to overwrite the file. If
they answer anything that begins with y or Y, the file should be overwritten. Otherwise, it should
not be overwritten and the program must exit.
My textbook also gave guidelines on how the code should look.
5. If a FileNotFoundException occurs when attempting to open an output file, the program must
output the error message, Cannot create output file and exit.
6. If the input file (a) does not contain seven items on each line as described above, (b) the
patient ids do not start with 1001 and increase by 1 for each patient, (c) the height and/or weight
are not integer values, (d) the temperature is not a double value (note that all integer values are
also double values), or (e) the file contains more lines than the maximum number of patients, the
program must output the error message, Invalid input file and exit.1// Reads each line of the
input file, and stores the patient id, name, birthdate, // height, weight, temperature, and blood
pressure // in the appropriate array parameter 4// Returns true, if successful // Returns false, if 6 //
(a) a line of the file does not contain seven items on each line as described above, 7 (l) (b) the
patient ids do not start with 1001 and increase by 1 for each patient, 8// (c) the height and/or
weight are not integer values, 9 (l) (d) the temperature is not a double value (note that all integer
values are also double values), 0 (e) or the file contains more lines than the maximum number of
patients (note that the length of 1/ each array corresponds to the maximum number of patients)
2/13// Throws an IllegalArgumentException with the message 4// "Null file" if in is null 1/ //
Throws an IllegalArgumentException with the message 8// and/or bloodPressures are/is null 1/ //
Throws an IllegalArgumentException with the message 1// "Invalid array length" if the lengths
2. of the array parameters are not the same // and / or <11/1 // NOTE: You must check for invalid
parameters (arguments) in the order given above. public static boolean inputPatients(Scanner in,
int[] ids, String[] names, String[] birthdates, int [] heights, int[] weights, double[] temperatures,
String[] bloodPressures) {
1 // Returns a String with each patient id, name, birthdate, height, weight, temperature, and 2 //
blood pressure with a newline character after the String for each patient. Only include // a String
for the patients, if any, for which there is an id (1001, 1002, etc.) 4// in the ids array. These
should be at the beginning of the ids array potentially followed // os for patients that have not
been added. 1/ // Use the provided tostring() method below to ensure /1 that the formatting of
each line is correct. 1/ 1/ Throws an IllegalArgumentException with the message // "Null array"
if any array parameter is null 1/ /1 Throws an IllegalArgumentException with the message //
"Invalid array length" if the lengths of array parameters are not the same 1/ // NOTE: You must
check for invalid parameters (arguments) in the order given above. public static string
getPatientList(int[] ids, string[] names, string[] birthdates, int [] heights, int [] weights, double[]
temperatures, string[] bloodPressures) {
1 // DO NOT CHANGE METHOD HEADER OR METHOD CONTENTS! //Returns formatted
string for patient public static string tostring(int id, String name, String birthdate, int height, int
weight, double temperature, String bloodPressure) { return String. format "%4d %-18s %10s
%2d %3d %6.2f%7s", id, name, birthdate, height, weight, temperature, bloodPressure ); }
JAVA // Prompts the user for the id of the patient to be updated. // If the id does not exist,
"Invalid id" is returned. // // Prompts the user for the patient's height, weight, temperature, and
blood pressure. // If the height or weight are not integer values or the temperature is not a double
value, // "Invalid value" is returned as soon as one invalid value is entered. // I/ If valid values are
entered, the patient's height, weight, temperature, and blood pressure // are updated and
"Successful update" is returned. // // Throws an IllegalArgumentException with the message //
"Null array" if ids, names, birthdates, heights, weights, temperatures, // and/or bloodPressures
are/is null /1 // Throws an IllegalArgumentException with the message 1/ "Invalid array length"
if the lengths of the array parameters are not the same // and/or <1/1 // NOTE: You must check
for invalid parameters (arguments) in the order given above. public static String
updatePatient(Scanner scnr, int[] ids, String[] names, String[] birthdates, int [] heights, int[]
weights, double[] temperatures, String[] bloodPressures) {
// If the maximum number of patients has been reached, i.e., none of the values in the ids array
are , // "Cannot add new patient" is returned 1/ // Prompts the user for the patient's name,
3. birthdate, height, weight, temperature, and blood pressure. // If the height or weight are not
integer values or the temperature is not a double value, // "Invalid value" is returned as soon as
one invalid value is entered. 1/ // If valid values are entered, the patient is assigned the next
available id, // the patient's information is added, and "Successful addition" is returned. 1/ //
Throws an IllegalArgumentException with the message // "Null array" if ids, names, birthdates,
heights, weights, temperatures, // and/or bloodPressures are/is null 1/ // Throws an
IllegalArgumentException with the message // "Invalid array length" if the lengths of the array
parameters are not the same // and / or <11/ // NOTE: You must check for invalid parameters
(arguments) in the order given above. public static string addPatient(Scanner scnr, int[] ids,
String[] names, String[] birthdates, int [] heights, int[] weights, double[] temperatures, String[]
bloodPressures) {
// Outputs the information for each patient to the file in CSV format as described above. /l //
Throws an IllegalArgumentException with the message // "Null file" if out is null /1 // Throws an
IllegalArgumentException with the message // "Null array" if any array parameter is null I/ //
Throws an IllegalArgumentException with the message 1/ "Invalid array length" if the lengths of
the array parameters are not the same // and/or <1 /I // NOTE: You must check for invalid
parameters (arguments) in the order given above. public static void outputPatients(PrintWriter
out, int[] ids, String[] names, String[] birthdates, int[] heights, int[] weights, double[]
temperatures, string [] bloodPressures) {