Question: Fix the application ERRORS and add CODE so that it will calculate and display the charges for a hospital stay. The hospital charges $350 per

Fix the application ERRORS and add CODE so that it will calculate and display the charges for a hospital stay. The hospital charges $350 per day. The calculate button calculates and displays the total cost in the appropriate output label. Use the try.parse method to convert text from text box to numeric data. If the user fails to enter numeric values display an appropriate error message and do not perform the calculations. Do not accept values of less than zero for the input data. Set the focus to the bad data and select it. The clear button clears input and output and resets the focus to the length of stay text box. The exit button ends the application. Use tooltips for the buttons. The application will accept the following input. The number of days spent in the hospital, as an integer. The amount of medication charges. The amount of surgical charges. The amount of lab fees. The amount of physical rehabilitation charges.

Fix the application ERRORS and add CODE so that it will calculate

and display the charges for a hospital stay. The hospital charges $350

per day. The calculate button calculates and displays the total cost in

the appropriate output label. Use the try.parse method to convert text from

10 Public class Calccharges Const deccHARGE PER DAY AS Deial The charge per day for the hosptial sta)y 14 Private Sub btncalculatecharges_click) Handles btncalculatecharges.click Local variable declarations Dim intLengthofstay As Integer Dim decMedicationcharges As Decimal Dim decSurgicalcharges AS Decimal Dim decLabFees As Decimal Dim decPhysicalRehabCharges As Decimal To hold the physical rehabilitation charges Dim decstayCharges As Decimal Dim decMisccharges As Decimal Dim decTotalcharges As Decimal " To hold the number of days in the hospital " To hold the medication charges " To hold the surgical charges ' To hold the lab fees 16 17 19 " To hold the base charges for the hospital stay " To hold the total of miscelaneous charges " To hold the total charges If Not Integer.TryParse(txtLengthofstay. Text, intLengthofstay) OrElse intLengthofstay 0.e Then 26 MessageBox.Show("Length of stay must be positive a numeric integer", "Data input error") '1blMessage.Text"The length of stay must be a positive integer." With txtLengthofstay 29 30 31 32 Focus() SelectAl1) End With Return End If 35 36 37 38 39 If Not ValidateInputField(txtMedicationcharges, decMedicationcharges, "Medication charges") Thern Elself Not validateInputField(txtsurgicalcharges, decsurgicalcharges, " ") Then ElseIf Not validateInputField(txtLabFees, , "Lab fees ") Then ElseIf Not validateInputField) Then End If Return Return Return Return 41 43 Try 47 All input fields are assumed to be valid at this point, so now we can 49 50 51 52 53 calculate and display the charges decstayCharges - Calcstaycharges) decMisccharges CalcMiscCharges (decMedicationcharges, decSurgicalcharges, decLabFees, decPhysicalRehabcharges) decTotalcharges ca1cTotalcharges (decstaychanges, decMisccharges) lblMessage.Text "Total Cost: " &decTotalCharges.Tostring("c) btnclearForm.Focus) 58 59 60 61 62 63 Catch anyException As Exception Display generic error message. MessageBox.Show(anyException.Message, "Miscellaneous error caught by system", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) 65 End Try

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!