chamsi09

Untitled

Oct 15th, 2024
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.31 KB | None | 0 0
  1. Module ClinicDiagnosis
  2.  
  3.     ' Global variable to track the total cost
  4.     Dim totalCost As Integer = 0
  5.  
  6.     Function ConductTest1() As Boolean
  7.         totalCost += 100 ' Add cost for the test
  8.         Console.WriteLine("Conducting Test 1...")
  9.         ' Assume this test returns a negative result
  10.         Return False
  11.     End Function
  12.  
  13.     Function ConductTest2() As Boolean
  14.         totalCost += 100 ' Add cost for the test
  15.         Console.WriteLine("Conducting Test 2...")
  16.         ' Assume this test returns a positive result
  17.         Return True
  18.     End Function
  19.  
  20.     Function ConductTest3() As Boolean
  21.         totalCost += 100 ' Add cost for the test
  22.         Console.WriteLine("Conducting Test 3...")
  23.         ' Assume this test would return a negative result
  24.         Return False
  25.     End Function
  26.  
  27.     Sub CheckForDiagnosis()
  28.         ' Using short-circuiting with OrElse
  29.         If ConductTest1() Or ConductTest2() Or ConductTest3() Then
  30.             Console.WriteLine("Diagnosis identified.")
  31.         Else
  32.             Console.WriteLine("No issues detected in all tests.")
  33.         End If
  34.  
  35.         ' Display total cost
  36.         Console.WriteLine($"Total cost of tests: ${totalCost}")
  37.     End Sub
  38.  
  39.     Sub Main()
  40.         ' Initiate the test process
  41.         CheckForDiagnosis()
  42.     End Sub
  43.  
  44. End Module
  45.  
Advertisement
Add Comment
Please, Sign In to add comment