Patient Prioritizing
Scoring Patients
Reminder: be very careful NOT to use the Scanner
‘s nextLine()
method! Some very unintuitive and tricky bugs arise when you mix nextLine()
and nextInt()
calls on the same Scanner
, so make sure to only use next()
for non-numerical user input in this assessment.
As a reference, here are the ? Program Behavior and ? Program Structure sections from the spec! Make sure to still refer back to the actual Specification for the ?? User Input, ? Priority Score, and ? Daily Statistics sections 🙂
? Program Behavior
Expand
You can see an example interaction with the program below (user input is bold and underlined):
Hello! We value you and your time, so we will help
you prioritize which patients to see next!
Please answer the following questions about the next patient so
we can help you do your best work 🙂
Please enter the next patient’s name or “quit” to end the program.
Patient’s name: Jun
Patient age: 5
Patient zip code: 44467
Is our hospital “in network” for the patient’s insurance? yes
Patient pain level (1-10): 2
Patient temperature (in degrees Fahrenheit): 99.8
We have found patient Jun to have a priority score of: 203
We have determined this patient is medium priority.
Please assign an appropriate medical provider to their case
and check back in with the patient’s condition in a little while.
Thank you for using our system!
We hope we have helped you do your best!
Please enter the next patient’s name or “quit” to end the program.
Patient’s name: Emma
Patient age: 77
Patient zip code: 12487
Is our hospital “in network” for the patient’s insurance? y
Patient pain level (1-10): 10
Patient temperature (in degrees Fahrenheit): 101.7
We have found patient Emma to have a priority score of: 311
We have determined this patient is high priority,
and it is advised to call an appropriate medical provider ASAP.
Thank you for using our system!
We hope we have helped you do your best!
Please enter the next patient’s name or “quit” to end the program.
Patient’s name: Johan
Patient age: 22
Patient zip code: 92107
Is our hospital “in network” for the patient’s insurance? no
Patient pain level (1-10): 5
Patient temperature (in degrees Fahrenheit): 104.3
We have found patient Johan to have a priority score of: 123
We have determined this patient is low priority.
Please put them on the waitlist for when a medical provider becomes available.
Thank you for using our system!
We hope we have helped you do your best!
Please enter the next patient’s name or “quit” to end the program.
Patient’s name: quit
Statistics for the day:
…3 patients were helped
…the highest priority patient we saw had a score of 311
Good job today!
The program begins by printing a short introduction. Then, the program prompts for a patient’s name, followed by the patient information that will be used to compute the priority score (see below). The program uses this information to compute a score and determine the patient’s priority. This information is printed out, along with a brief recommendation based on the priority. The program then prints a thank you message and prompts for another patient name. This process continues until the word quit
(all lowercase) is typed as the name, at which point summary statistics for the day are printed (see the ? Daily Statistics section below).
Note that your output will not have the underlined and bolded text like the above — this is just for the purposes of the example!
? Program Structure
Expan
Your program should utilize methods, parameters, and returns to add a clear and understandable structure to the code. In particular, your code should include at least the following 7 methods with the indicated parameters and return values:
A method to print the program’s introduction message
no parameters
no return value
A method to get a patient’s name through user input
takes one Scanner
parameter
returns the name read from input
A method to collect the required patient information (age, zip code, insurance information, pain level, and temperature) and compute the priority score by calling method 4.
takes one Scanner
parameter
returns the computed score
A method to calculate the priority score of the patient (this method should only be called in the above method)
takes five parameters, once for each patient feature
returns the computed score
A method to print the patient’s priority
takes two parameters– the name and the score
no return value
A method to print out the overall statistics for the day
takes two parameters– the number of patients and the maximum score
no return value
A method to find out if the zip code has 5 digits (this is provided in your workspace)
With the exception of methods 4 and 7, all these methods should be called from main
. Method 4 should be called from method 3. Method 7 should be called where ever you check that the user input is valid.
You may include additional methods if you wish, but you must include these methods as defined. (Naturally, your program will also include a main
method.)
Along with the required methods above, you must have a loop in main
which allows the program to keep asking for new patient information until the user chooses to quit. Hint: you’ll likely have to calculate the maximum score in the main method (think conditionals!) 😉
?Commenting & Code Quality
Your program should include header, class, and method comments as described in the CSE 121 Commenting Guide.
Your code should also adhere to the guidelines laid out in the CSE 121 Code Quality Guide. In particular, pay attention to the following details in the guide:
Forbidden features should NEVER be used in any graded CSE 121 work.
Using correct and consistent indentation
Proper line length
Using descriptive names that are camelCased
Using the proper loop variable naming convention for nested for
loops with either:
using descriptive loop variable names
using use i-j-k
convention for loop variable names where i
should be used for outer-loops, j
for once-nested loops, k
for twice nested loops, etc.
Note: if we use i-j-k
convention for loop variable names, we don’t want to mix them with descriptive loop variable names!
Following the printing conventions (i.e., printing blank lines using System.out.println()
rather than System.out.println("")
, using System.out.println()
statements rather than by including n
, combining sequential System.out.print()
statements)
Correct declaration
Following good practices such as avoiding extra parameters
Each method should have a method comment that describes the method’s behavior, parameters (if any), and return value (if any)
Adding one blank line between the closing curly brackets of a method and the next method comment
?Click Expand to see an example!
Expand
// Draws a rectangle shaped figure // Parameters: // int side – the width of the rectangle // int height – the height of the rectangle public static void drawSquare(int width, int height) { … } // Rounds a number to two decimal places // Parameters: // double input – the number to be rounded // Returns: // double – The rounded number public static double roundTwoDec(double input) { … }
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.