SlideShare a Scribd company logo
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.pdf
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 
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
amazonedistributors
 

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

How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 

Recently uploaded (20)

How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 

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