SlideShare a Scribd company logo
1 of 3
Download to read offline
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
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,
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) {

More Related Content

More from amazonedistributors

Need help answering 1(a-d). Service DepartmentsProduction Department.pdf
Need help answering 1(a-d). Service DepartmentsProduction Department.pdfNeed help answering 1(a-d). Service DepartmentsProduction Department.pdf
Need help answering 1(a-d). Service DepartmentsProduction Department.pdfamazonedistributors
 
Need correct answer please using Laplace Smoothing Method Please ..pdf
Need correct answer please using Laplace Smoothing Method Please ..pdfNeed correct answer please using Laplace Smoothing Method Please ..pdf
Need correct answer please using Laplace Smoothing Method Please ..pdfamazonedistributors
 
Necesito ayuda para responder la respuesta del art�culo. Los abuel.pdf
Necesito ayuda para responder la respuesta del art�culo. Los abuel.pdfNecesito ayuda para responder la respuesta del art�culo. Los abuel.pdf
Necesito ayuda para responder la respuesta del art�culo. Los abuel.pdfamazonedistributors
 
Necesita ayuda para responder las siguientes preguntasstarbucks.pdf
Necesita ayuda para responder las siguientes preguntasstarbucks.pdfNecesita ayuda para responder las siguientes preguntasstarbucks.pdf
Necesita ayuda para responder las siguientes preguntasstarbucks.pdfamazonedistributors
 
Nash Incs EPS is $6.72 and its dividend payout ratio is 0.7. the co.pdf
Nash Incs EPS is $6.72 and its dividend payout ratio is 0.7. the co.pdfNash Incs EPS is $6.72 and its dividend payout ratio is 0.7. the co.pdf
Nash Incs EPS is $6.72 and its dividend payout ratio is 0.7. the co.pdfamazonedistributors
 
NASA must determine how many of three types of objects to bring on b.pdf
NASA must determine how many of three types of objects to bring on b.pdfNASA must determine how many of three types of objects to bring on b.pdf
NASA must determine how many of three types of objects to bring on b.pdfamazonedistributors
 
Name these structures A. Identify this region B. Identify these fold.pdf
Name these structures A. Identify this region B. Identify these fold.pdfName these structures A. Identify this region B. Identify these fold.pdf
Name these structures A. Identify this region B. Identify these fold.pdfamazonedistributors
 
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdfn2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdfamazonedistributors
 
No plagiarism and at least 250 wordsBriefly describe the dif.pdf
No plagiarism and at least 250 wordsBriefly describe the dif.pdfNo plagiarism and at least 250 wordsBriefly describe the dif.pdf
No plagiarism and at least 250 wordsBriefly describe the dif.pdfamazonedistributors
 
no need to invlude comments in the code. 1. Follow the FDR to im.pdf
no need to invlude comments in the code. 1. Follow the FDR to im.pdfno need to invlude comments in the code. 1. Follow the FDR to im.pdf
no need to invlude comments in the code. 1. Follow the FDR to im.pdfamazonedistributors
 
Nonylphenol (NP) is commonly found in municipal wastewater and solid.pdf
Nonylphenol (NP) is commonly found in municipal wastewater and solid.pdfNonylphenol (NP) is commonly found in municipal wastewater and solid.pdf
Nonylphenol (NP) is commonly found in municipal wastewater and solid.pdfamazonedistributors
 
North Korea Is a socialist state. The system is a single-party regim.pdf
North Korea Is a socialist state. The system is a single-party regim.pdfNorth Korea Is a socialist state. The system is a single-party regim.pdf
North Korea Is a socialist state. The system is a single-party regim.pdfamazonedistributors
 
Noel Arrold podr�a haber terminado en trigo. O en el sal�n de clases.pdf
Noel Arrold podr�a haber terminado en trigo. O en el sal�n de clases.pdfNoel Arrold podr�a haber terminado en trigo. O en el sal�n de clases.pdf
Noel Arrold podr�a haber terminado en trigo. O en el sal�n de clases.pdfamazonedistributors
 
Nike vendiendo una l�nea de ropa para acompa�ar su producto principa.pdf
Nike vendiendo una l�nea de ropa para acompa�ar su producto principa.pdfNike vendiendo una l�nea de ropa para acompa�ar su producto principa.pdf
Nike vendiendo una l�nea de ropa para acompa�ar su producto principa.pdfamazonedistributors
 
Ninna Banks is responsible for recording cash disbursements, prepari.pdf
Ninna Banks is responsible for recording cash disbursements, prepari.pdfNinna Banks is responsible for recording cash disbursements, prepari.pdf
Ninna Banks is responsible for recording cash disbursements, prepari.pdfamazonedistributors
 
Nike Case StudyDoes Jeff Ballinger have a convincing argument abo.pdf
Nike Case StudyDoes Jeff Ballinger have a convincing argument abo.pdfNike Case StudyDoes Jeff Ballinger have a convincing argument abo.pdf
Nike Case StudyDoes Jeff Ballinger have a convincing argument abo.pdfamazonedistributors
 
NIIF 9 instrumento financiero permite el uso de contabilidad de cobe.pdf
NIIF 9 instrumento financiero permite el uso de contabilidad de cobe.pdfNIIF 9 instrumento financiero permite el uso de contabilidad de cobe.pdf
NIIF 9 instrumento financiero permite el uso de contabilidad de cobe.pdfamazonedistributors
 
Nicholas is currently in eighth grade and intends to attend a state .pdf
Nicholas is currently in eighth grade and intends to attend a state .pdfNicholas is currently in eighth grade and intends to attend a state .pdf
Nicholas is currently in eighth grade and intends to attend a state .pdfamazonedistributors
 
NetworkingShow the commandsUsing nmcli , create a new network .pdf
NetworkingShow the commandsUsing nmcli , create a new network .pdfNetworkingShow the commandsUsing nmcli , create a new network .pdf
NetworkingShow the commandsUsing nmcli , create a new network .pdfamazonedistributors
 
Network Environment & Configuration Requirements You are a support t.pdf
Network Environment & Configuration Requirements You are a support t.pdfNetwork Environment & Configuration Requirements You are a support t.pdf
Network Environment & Configuration Requirements You are a support t.pdfamazonedistributors
 

More from amazonedistributors (20)

Need help answering 1(a-d). Service DepartmentsProduction Department.pdf
Need help answering 1(a-d). Service DepartmentsProduction Department.pdfNeed help answering 1(a-d). Service DepartmentsProduction Department.pdf
Need help answering 1(a-d). Service DepartmentsProduction Department.pdf
 
Need correct answer please using Laplace Smoothing Method Please ..pdf
Need correct answer please using Laplace Smoothing Method Please ..pdfNeed correct answer please using Laplace Smoothing Method Please ..pdf
Need correct answer please using Laplace Smoothing Method Please ..pdf
 
Necesito ayuda para responder la respuesta del art�culo. Los abuel.pdf
Necesito ayuda para responder la respuesta del art�culo. Los abuel.pdfNecesito ayuda para responder la respuesta del art�culo. Los abuel.pdf
Necesito ayuda para responder la respuesta del art�culo. Los abuel.pdf
 
Necesita ayuda para responder las siguientes preguntasstarbucks.pdf
Necesita ayuda para responder las siguientes preguntasstarbucks.pdfNecesita ayuda para responder las siguientes preguntasstarbucks.pdf
Necesita ayuda para responder las siguientes preguntasstarbucks.pdf
 
Nash Incs EPS is $6.72 and its dividend payout ratio is 0.7. the co.pdf
Nash Incs EPS is $6.72 and its dividend payout ratio is 0.7. the co.pdfNash Incs EPS is $6.72 and its dividend payout ratio is 0.7. the co.pdf
Nash Incs EPS is $6.72 and its dividend payout ratio is 0.7. the co.pdf
 
NASA must determine how many of three types of objects to bring on b.pdf
NASA must determine how many of three types of objects to bring on b.pdfNASA must determine how many of three types of objects to bring on b.pdf
NASA must determine how many of three types of objects to bring on b.pdf
 
Name these structures A. Identify this region B. Identify these fold.pdf
Name these structures A. Identify this region B. Identify these fold.pdfName these structures A. Identify this region B. Identify these fold.pdf
Name these structures A. Identify this region B. Identify these fold.pdf
 
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdfn2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
 
No plagiarism and at least 250 wordsBriefly describe the dif.pdf
No plagiarism and at least 250 wordsBriefly describe the dif.pdfNo plagiarism and at least 250 wordsBriefly describe the dif.pdf
No plagiarism and at least 250 wordsBriefly describe the dif.pdf
 
no need to invlude comments in the code. 1. Follow the FDR to im.pdf
no need to invlude comments in the code. 1. Follow the FDR to im.pdfno need to invlude comments in the code. 1. Follow the FDR to im.pdf
no need to invlude comments in the code. 1. Follow the FDR to im.pdf
 
Nonylphenol (NP) is commonly found in municipal wastewater and solid.pdf
Nonylphenol (NP) is commonly found in municipal wastewater and solid.pdfNonylphenol (NP) is commonly found in municipal wastewater and solid.pdf
Nonylphenol (NP) is commonly found in municipal wastewater and solid.pdf
 
North Korea Is a socialist state. The system is a single-party regim.pdf
North Korea Is a socialist state. The system is a single-party regim.pdfNorth Korea Is a socialist state. The system is a single-party regim.pdf
North Korea Is a socialist state. The system is a single-party regim.pdf
 
Noel Arrold podr�a haber terminado en trigo. O en el sal�n de clases.pdf
Noel Arrold podr�a haber terminado en trigo. O en el sal�n de clases.pdfNoel Arrold podr�a haber terminado en trigo. O en el sal�n de clases.pdf
Noel Arrold podr�a haber terminado en trigo. O en el sal�n de clases.pdf
 
Nike vendiendo una l�nea de ropa para acompa�ar su producto principa.pdf
Nike vendiendo una l�nea de ropa para acompa�ar su producto principa.pdfNike vendiendo una l�nea de ropa para acompa�ar su producto principa.pdf
Nike vendiendo una l�nea de ropa para acompa�ar su producto principa.pdf
 
Ninna Banks is responsible for recording cash disbursements, prepari.pdf
Ninna Banks is responsible for recording cash disbursements, prepari.pdfNinna Banks is responsible for recording cash disbursements, prepari.pdf
Ninna Banks is responsible for recording cash disbursements, prepari.pdf
 
Nike Case StudyDoes Jeff Ballinger have a convincing argument abo.pdf
Nike Case StudyDoes Jeff Ballinger have a convincing argument abo.pdfNike Case StudyDoes Jeff Ballinger have a convincing argument abo.pdf
Nike Case StudyDoes Jeff Ballinger have a convincing argument abo.pdf
 
NIIF 9 instrumento financiero permite el uso de contabilidad de cobe.pdf
NIIF 9 instrumento financiero permite el uso de contabilidad de cobe.pdfNIIF 9 instrumento financiero permite el uso de contabilidad de cobe.pdf
NIIF 9 instrumento financiero permite el uso de contabilidad de cobe.pdf
 
Nicholas is currently in eighth grade and intends to attend a state .pdf
Nicholas is currently in eighth grade and intends to attend a state .pdfNicholas is currently in eighth grade and intends to attend a state .pdf
Nicholas is currently in eighth grade and intends to attend a state .pdf
 
NetworkingShow the commandsUsing nmcli , create a new network .pdf
NetworkingShow the commandsUsing nmcli , create a new network .pdfNetworkingShow the commandsUsing nmcli , create a new network .pdf
NetworkingShow the commandsUsing nmcli , create a new network .pdf
 
Network Environment & Configuration Requirements You are a support t.pdf
Network Environment & Configuration Requirements You are a support t.pdfNetwork Environment & Configuration Requirements You are a support t.pdf
Network Environment & Configuration Requirements You are a support t.pdf
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 

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) {