1. Write a method called playlist builder that takes no parameters and returns an ArrayList of Strings. In the method body, declare an ArrayList of Strings called playList and populate it with songs (Strings) using input from the user at the command line. The user can enter as many songs as they like. Use a sentinel to allow the user to indicate when they are finished. Don't forget to include a prompt. 2. Write a method called search playlist that takes an ArrayList of Strings as a parameter (the playList) and returns an integer. In the method body, prompt the user to enter a search term (a String), then count how many times the search term appears in the playlist ArrayList. (Hint: use the String.contains() method to check each String in the playList) The method returns the count. Note the next two methods are unrelated to the playList methods above. 3. Write a method called get vital signs The method takes no parameters and returns an array of three ints. Call this array vitals. The method gets three values from the user: heart rate, systolic blood pressure, and respiration. Prompt for each of them. The three values are stored in positions 0, 1, and 2 of the vitals array.
4. Write a method called check vitals that takes an array of ints (the vitals array from #3 above) as a parameter and has no return value. The method uses the vitals array and the following table of rules to make an assessment of the patient’s condition (these are simplifications). Remember that heart rate, systolic blood pressure, and respirations are stored in positions 0, 1, and 2 of the vitals array. Normal RangeLow ConditionHigh Condition Heart Rate 60-100 BradycardiaTachycardia Systolic Blood Pressure90-120 HypotensionHypertension Respirations 12-20 BradypneaTachypnea After using the vitals array values to decide each of the conditions, output the condition statements to the command line as in this example: Heart Rate: NormalBlood Pressure: HypertensionRespirations: Normal 5. Call each of the four methods above from the main method in Unit6Quiz.java.
Get Free Quote!
394 Experts Online