Visual Basic Hospital Charges Create an application that calculates the total cost of a hospital stay. The application should accept the following input: � The number of days spent in the � The amount...





Visual Basic Hospital Charges Create an application that calculates the total cost of a hospital stay. The application should accept the following input: � The number of days spent in the � The amount of medication charges � The amount of surgical charges � The amount of lab fees � The amount of physical rehabilitation charges The hospital charges $350 per day. The applications form should resemble the one shown in Figure 6-23. Create the following functions: Calc Stay Charges Calculates and returns the base charges for the hospital

stay. This is computed as $350 times the number of days in the hospital. Calc Misc Charges Calculates and returns the total of the medication, surgical, lab, and physical rehabilitation charges. Calc Total Charges Calculates and returns the total charges. Validate Input Fields Checks the validity of the input fields by converting each to a numeric value and checking its range. If any input field is found to be invalid, this function displays an error

message and returns a value of False. input Validation: Do not accept a negative value for length of stay, medication charges, surgical charges, lab fees, or physical rehabilitation charges. When displaying error messages, use a Label control and specifically name the missing field and the type of data to be entered (integer or numeric). I've completed the following instructions;


Create a form as shown below with components named as Labels :Label1, Label2, Label3, Label4, Label5 -For displaying text value name of textboxes Label6-For storing output value


TextBoxes:TextBox1: inputStayTextBox2: inputMedsTextBox3: inputSurgicalTextBox4: inputLabFeesTextBox5: input Surgical Three Buttons Calculate Charges, Clear, Exit


Functional code: Clicking on Calcuate charges button and add code:


Private Sub Button1_Click(By Val sender As System .Object, ByVal e As System .Event Args) Handles Button1.Click Dim Stay Charge As Decimal Dim Misc Charge As Decimal Dim Total Cost As Decimal Stay Charge = Calculate Stay Charges(input Stay. Text) Misc Charge = Calculate Misc Charges(input Meds. Text, input Surgical. Text, input Lab Fees. Text, input Rehab. Text) Total Cost = Calculate Total Charges(Stay Charge, Misc Charge) Output. Text = Format Currency(Total Cost), End Sub Function Code: Function CalculateStayCharges(ByVal txtStay As String) As Decimal Dim Stay Charges As Decimal Dim NumDays As Decimal Try Num Days = txt Stay Catch ex As Exception Message Box. Show("All Charges Must Be Zero or More", "CHECK INPUT!") End Try If Num Days <>


Stay Charges = num Days * 350 Return Stay Charges End End Function Function Calculate Misc Charges(ByVal txtMeds As String, ByVal txtSurgical As String, _ byVal txtLabFees As String, ByVal txtRehab As String) As Decimal Dim MiscCharges As Decimal Dim Meds As Decimal Dim Surgical As Decimal Dim Lab Fees As Decimal Dim Rehab As Decimal Try Meds = C Dec(input Meds. Text) Surgical = CD ec(input Surgical. Text) Lab Fees = C Dec(input Lab Fees. Text)


Rehab = C Dec(input Rehab. Text) Catch ex As Exception Message Box. Show("All Charges Must Be Zero or More", "INVALID INPUT!") Go To Re Do End Try If Meds <><><><>


Total = Stay Charges + Misc Charge Return Total End Function


Button Clear:Private Sub Clear() 'The Clear sub routine inputStay.Text = " "


Input Surgical.Text = " " inputLabFees.Text = " " inputMeds.Text = " "inputRehab.Text = " "Output.Text = " " End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs)Handles Button2.Click Clear()


End SubExit Button: Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click, Me.Close()End Sub


Sample Run:


But there is an error in the code on the following line;


Function CalculateMiscCharges(ByVal txtMeds As String, ByVal txtSurgical As String, _

ByVal txtLabFees As String, ByVal txtRehab As String) As Decimal


 Error is as follows: 'Public Function CalculateMiscCharges(txtMeds As String, txtSurgical As String, txtLabFees As String, txtRehab As String) As Decimal' has multiple definitions with identical signatures. How do I resolve this error?


May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here