1. Other
  2. Other
  3. construct a solution algorithm for the following problems your question...

Question: construct a solution algorithm for the following problems your question...

Question details

Construct a solution algorithm for the following problems. Your question solution should contain: 

·       Defining problem 

·       Pseudo code algorithm 
Use as Java code in eclipse 

·       Desk check of the algorithm 

o   (Three test cases for each question)

o   (Two valid and one error test case if appropriate) 

_____________________________________________________________________________________

The Meteorological service requires a program to allow the operator to enter the rainfall level. The program keep accepting the rainfall level until a negative or zero value is entered. The program will keep displaying the current min, max and running average rainfall level after an entry is made. The program terminates by the operator entering a negative value or zero and displaying the total number of entries made. 

 

Sample output. The text in bold is the user inputs.
(Note you need not make the user inputs bold in actual program) 

 

Enter rainfall :  3.2

Min :  3.2     Max :  3.2     Ave :  3.2

 

Enter rainfall :  3.8

Min :  3.2     Max :  3.8     Ave :  3.5

 

Enter rainfall :  2

Min :  2.0     Max :  3.8     Ave :  3.0

 

Enter :  -1

Rainfall entries made :  3

 

No error check required.
Assume user always enter number. 

 

example answer :

Defining diagram :

 

Input

Processing

Output

 

Patient’s details

-       Name

-       Height

-       Weight

 

 

Display Heading

Read patient’s detail

Calculate BMI

Print BMI value and patient’s status.

 

 

Patient’s details

-       BMI value

-       Patient’s status

 

Solution algorithm :

 

Print_BMI_results

            Display ‘BODY MASS INDEX’ heading

            DOWHILE more records exist

                        Read patient detail

                               BMI = (Weight_kg/ ((Height_cm ^2)*0.0001))

                        IF BMI <= 24 THEN

                                    status = ‘Under Weight’

                        ELSE IF BMI >= 29 THEN

                                    status = ‘Healthy’

                        ELSE IF BMI >= 34 THEN

                                    status = ‘Overweight’

                        ELSE IF BMI > 34 THEN

                                    status = ‘Obese’

            

                        ENDIF

                        Display patient_BMIValue, patient_status

            ENDDO

END

Solution by an expert tutor
Blurred Solution