Java Program: Patient Covid Check
Program Code:
// User defined Exception class CovidPositiveException extends Exception { public
CovidPositiveException(String msg) { super(msg); } } // Patient class class Patient {
String name; int age; int oxyLevel; int hrctReport; Patient(String n, int a, int oxy,
int hrct) { name = n; age = a; oxyLevel = oxy; hrctReport = hrct; } void showDetails()
throws CovidPositiveException { if (oxyLevel < 95 && hrctReport > 10) { throw new
CovidPositiveException("Patient is Covid Positive(+) and Need to Hospitalized"); } else
{ [Link]("Patient Name : " + name); [Link]("Patient Age : " +
age); [Link]("Oxygen Level : " + oxyLevel + "%"); [Link]("HRCT
Report : " + hrctReport); } } } // Main class public class PatientTest { public static
void main(String[] args) { // Create one patient object Patient p = new Patient("Rohan",
30, 92, 12); try { [Link](); } catch (CovidPositiveException e) {
[Link]("Exception: " + [Link]()); } } }