Question: Purpose: This Windows application determines which patients have a systolic blood pressure reading that is considered too high. Program Procedures: In a Windows application, a
Purpose:
This Windows application determines which patients have a systolic blood pressure reading that is considered too high.
Program Procedures:
In a Windows application, a text file of patient information named patient.txt is opened. The patients who have a systolic reading above are written to a second text file named consult txt for consultation. The systolic reading is the first number in blood pressure results.
Algorithms, Processing, and Conditions:
Each day, a text file named patient.txt is opened from the USB drive. The patient.txt file contains patient names, ID numbers, and systolic blood pressure results from a lab.
An opening graphic and title are displayed on the Windows Form object.
A File menu includes options to Display Patient Information, Clear, and Exit. Selecting the Display Patient Information option displays the contents of the patient.txt file on a second Windows Form object.
The patient names and systolic blood pressure levels are assigned to an array that holds elements each.
Blood pressure systolic levels are tested to check whether the systolic number is above the value
All patients who have a systolic level above have their names and systolic results written to a text file named consult.txt on the USB drive. A nurse will contact these patients for further evaluation.
The program displays the number of patients who had a systolic level above and the average systolic value of todays patients.
My code:
Imports System.IO
Public Class BloodPressure
Private Sub PatientDataToolStripMenuItemClicksender As Object, e As EventArgs Handles PatientDataToolStripMenuItem.Click
Dim patientDataForm As New PatientData
patientDataForm.Show
End Sub
Private Sub ClearMenuItemClicksender As Object, e As EventArgs Handles ClearToolStripMenuItem.Click
End Sub
Private Sub ExitMenuItemClicksender As Object, e As EventArgs Handles ExitToolStripMenuItem.Click
MeClose
End Sub
End Class
Imports System.IO
Public Class PatientData
Private patientFNames As String
Private patientLName As String
Private patientId As Integer
Private systolicValues As Integer
Private patientCount As Integer
Private Sub PatientDataLoadsender As Object, e As EventArgs Handles MyBase.Load
Try
Dim lines As String File.ReadAllLinesD:patienttxt
For i As Integer To Math.MinlinesLength
Dim parts As String linesiSplitc
If parts.Length Then
patientFNamesi partsTrim
patientLNamei partsTrim
patientIdi Integer.ParsepartsTrim
systolicValuesi Integer.ParsepartsSplitcTrim
patientCount
End If
Next
DisplayPatientData
Catch ex As Exception
MessageBox.ShowError loading patient data: & exMessage
End Try
End Sub
Private Sub DisplayPatientData
Dim highSystolicCount As Integer
Dim totalSystolic As Integer
Dim consultList As New ListOf String
For i As Integer To patientFNames.Length
If String.IsNullOrEmptypatientFNamesi OrElse String.IsNullOrEmptypatientLNamei Then Continue For
If systolicValuesi Then
consultList.Add$patientFNamesipatientLNameisystolicValuesi
highSystolicCount
End If
totalSystolic systolicValuesi
Next
File.WriteAllLinesD:consulttxt consultList
lstName.Items.AddRangeconsultListToArray
lblHighCount.Text $"High Systolic Patients: highSystolicCount
lblAVGSystolic.Text $"Average Systolic: totalSystolic Math.Max patientFNames.Length:F
End Sub
End Class
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
