0% found this document useful (0 votes)
2 views1 page

Java Patient Covid Check Program

Uploaded by

solomonpillai25
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Java Patient Covid Check Program

Uploaded by

solomonpillai25
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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]()); } } }

You might also like