[SOLVED] COMP231-Assignment 1

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

Objectives:

 

Write a Java program that does the following:

1.     In the main() method complete the following:

1.    Read number of days that a patient has entered the hospital ( i.e 5 days)

2.    Read number of times that nurse read the temperature of the patient in Celsius (3,4, 5, time, oreven more)

4. Read the temperature that was read by the nurse and store each temperature in the array.

5.If the user enters a temperature below 30 C or above 45C, then display an error message and keep looping till the program gets the right.

2.     Write just one method (Summary) that called from the main method and return average, maximum, and minimum of temperatures. Print the result on screen from the main method.

3.     Call another method call it countbelowAboveAverage that will return a number of temperatures less than or equal to the average of temperatures, and the number of temperatures above the average.

4.     Call sorting method (sortArray)that will sort the temperatures (per day) in ascending order during all days store it in a new 2D dimensional array and return it to main. (use any type of sorting. You can’t use build-in methods)

5.     Call printArray method to print the sorted array on screen.

Call a method (leaveHospital) that will return yes he/she can leave or no, he/she can’t leave, to check if he/she can leave the hospital. The patient can leave only if the average for the last two highest read temperatures in the last two days was around normal (35.5-36.5 C). Sample:

Days           #of Readings           Actual Reading Per Day (in Celsius )

1
4
40.5
41
39.8
38.7
2
5
41.2
41.3
40.7
40.8 41.3
3
5
40.9
38.5
38.9
40.1 39.8
4
3
38.2
38.2
37.9

5                 2                          37.5            37.2

1

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.