0% found this document useful (0 votes)
3 views7 pages

Java 6

The document outlines a Java program for a Hospital Management System that manages patient data, specifically for COVID-19 patients. It includes classes for Patient and CovidParameters, allowing for input and display of patient details such as name, age, address, CT Score, D-Dimer, and platelet count. The program also provides options to set the size of the patient ward, enter patient details, display patients, and sort them by CT Score.

Uploaded by

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

Java 6

The document outlines a Java program for a Hospital Management System that manages patient data, specifically for COVID-19 patients. It includes classes for Patient and CovidParameters, allowing for input and display of patient details such as name, age, address, CT Score, D-Dimer, and platelet count. The program also provides options to set the size of the patient ward, enter patient details, display patients, and sort them by CT Score.

Uploaded by

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

Date: 05-03-2026

Roll No. and Name: 24BCE179 DEEP HIRPARA


Course Code and Name: JAVA PROGRAMMING
Practical No: 6
Aim:
import [Link].*;

class Patient{
int age;
String name;
String address;
Patient(){
age=0;
name="";
address="";
}
Patient(int age,String name,String address){
[Link]=age;
[Link]=name;
[Link]=address;
}
void display(){
[Link]("Name of patient:"+name);
[Link]("Age:"+age);
[Link]("Address:"+address);
}
}

class CovidParameters extends Patient{


Scanner sc=new Scanner([Link]);
float CTScore;
float Ddimer;
int platelet;

CovidParameters(){
super();
CTScore=0.0f;
Ddimer=0.0f;
platelet=0;
}
CovidParameters(float CTScore,float Ddimer,int platelet,int age,String
name,String address){
super(age,name,address);
[Link]=CTScore;
[Link]=Ddimer;
[Link]=platelet;
}
void Getter(){
[Link]("Enter the Patient's Name:");
name=[Link]();
[Link]("Enter the Patient's Age:");
age=[Link]();
[Link]();
[Link]("Enter the Patient's Address:");
address=[Link]();
[Link]("Enter the CT Score:");
CTScore=[Link]();
[Link]("Enter the D-Dimer:");
Ddimer=[Link]();
[Link]("Enter the Platelet Count:");
platelet=[Link]();
}
void display(){
[Link]();
[Link]("CT Score:"+CTScore);
[Link]("D-Dimer:"+Ddimer);
[Link]("Platelet Count:"+platelet);
}
}

public class Java6a{


public static void main(String[] args) {
Scanner sc=new Scanner([Link]);
CovidParameters[] hospitalWard=null;
int choice = 0;

[Link]("Welcome to the Hospital Management System");

while (choice != 5) {
[Link]("1. Set the Size of an Ward");
[Link]("2. Enter details for all Patients");
[Link]("3. Display all Patients");
[Link]("4. Display Patients sorted by highest CT Score");
[Link]("5. Exit");
[Link]("Enter your choice: ");

choice = [Link]();

switch(choice){
case 1:
[Link]("How many patients will be there? :");
int size = [Link]();
hospitalWard = new CovidParameters[size];
[Link]("Created !");
break;

case 2:
if (hospitalWard == null) {
[Link]("Please create the array first (Option 1).");
} else {
for (int i=0;i<[Link];i++) {
[Link]("\nEntering details for Patient " + (i + 1) + ":");
hospitalWard[i] = new CovidParameters();
hospitalWard[i].Getter();
}
}
break;

case 3:
if(hospitalWard == null || hospitalWard[0]==null) {
[Link]("No patients to display.");
}
else
{
for (int i = 0; i < [Link]; i++) {
[Link]("\n::: Patient " + (i + 1) + "::: ");
hospitalWard[i].display();

[Link]("---:::---:::---:::---:::---:::---:::---:::---:::---:::---:::---:::---:::---:::---");

}
}
break;

case 4:
if (hospitalWard == null || hospitalWard[0] == null) {
[Link]("No patients to sort.");
} else {
for (int i = 0; i < [Link] - 1; i++) {
for (int j = 0; j < [Link] - i - 1; j++) {
if (hospitalWard[j].CTScore < hospitalWard[j + 1].CTScore) {
CovidParameters temp = hospitalWard[j];
hospitalWard[j] = hospitalWard[j + 1];
hospitalWard[j + 1] = temp;
}
}
}
[Link]("\n Patients Sorted by Highest CT Score :::");
for (int i = 0; i < [Link]; i++) {
hospitalWard[i].display();

[Link]("---:::---:::---:::---:::---:::---:::---:::---:::---:::---:::---:::---:::---:::---");
}
}
break;
case 5:
[Link]("Exiting the program. Goodbye!");
break;
default:
[Link]("Invalid choice. Please try again.");
}
}
[Link]();
}
}

You might also like