A patient suffering from asthma needs to keep a diary of their “peak flow” breathing readings. This is just a number between 0 and 800 measuring how well they can blow air from their lungs. Their peak flow reading is the greatest of three readings taken at one time. Write a Java procedural program to help the patient record their peak flow to show their doctor. The program should first ask the patient for the number their doctor has given them as being a dangerous reading. Any peak flow reading recorded that is less than the danger level should lead to a message that they need to go to hospital immediately. Once entered, this value should not be changed. After storing this number, the program should go into a loop that only stops when they type 0 instead of a day. It should repeatedly ask them for the day of the month which is a number from 1 to 31 (they may skip days) and then the three readings taken that day. All the peak flow readings (ie the largest of each set of three readings) should be stored. Worryingly low peak flow readings should lead to warning messages printed as noted above. Once 0 is typed, the program should print the pairs of the day and reading in the order entered as well as storing them in a file to show to the patient’s Doctor. After doing so the program should end. Each entry, consisting of the day and reading, should be printed/stored on a new line. The day and reading should be separated by a comma (ie CSV / comma separated values format). You may assume that the report is needed at least once per month so there are never more than 31 readings to be stored.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

A patient suffering from asthma needs to keep a diary of their “peak flow” breathing
readings. This is just a number between 0 and 800 measuring how well they can
blow air from their lungs. Their peak flow reading is the greatest of three readings
taken at one time.

Write a Java procedural program to help the patient record their peak flow to show their
doctor.

The program should first ask the patient for the number their doctor has given them
as being a dangerous reading. Any peak flow reading recorded that is less than the
danger level should lead to a message that they need to go to hospital immediately.
Once entered, this value should not be changed.
After storing this number, the program should go into a loop that only stops when
they type 0 instead of a day. It should repeatedly ask them for the day of the month
which is a number from 1 to 31 (they may skip days) and then the three readings
taken that day. All the peak flow readings (ie the largest of each set of three
readings) should be stored. Worryingly low peak flow readings should lead to
warning messages printed as noted above.
Once 0 is typed, the program should print the pairs of the day and reading in the
order entered as well as storing them in a file to show to the patient’s Doctor. After
doing so the program should end. Each entry, consisting of the day and reading,
should be printed/stored on a new line. The day and reading should be separated
by a comma (ie CSV / comma separated values format). You may assume that the
report is needed at least once per month so there are never more than 31 readings
to be stored.

  • The program MUST be in procedural programming style
  • The program MUST be in procedural programming style to gain marks. It must use loops, records, methods and arrays
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education