C Java Assignment
C Java Assignment
Scenario: Ahospital server management system where patients can search for the best
doctors for their illnesses, and hospital management staff can add doctors and other
administrative staff using their ID and password.
Classes
1. ‘Person’ (Abstract Class)
Acts as a base class for all types of people in the hospital, defining common attributes and
methods. Contain an abstract method Details().
2. ‘Hospital_Employee’
Serves as an class for different types of employees in the hospital, inheriting from ‘Person’
and adding an ‘id’.
3. ‘Doctor’
Represents a doctor in the hospital, adding a specialization attribute and implementing the
abstract methods from ‘Hospital_Employee’.
4. ‘Management_Staff’
Represents a management staff member in the hospital, adding a password attribute and
implementing the abstract methods from ‘Hospital_Employee’.
5. ‘Patient’
Represents a patient in the hospital, inheriting from `Person` and adding an illness attribute.
6. ‘Server’
Provides various server functionalities to manage doctors, patients, and management staff,
including initializing arrays, creating new entries based on user input, and validating
credentials.
7. ‘Hospital_Management’
Acts as the entry point for the application, handling user input and coordinating interactions
between different components of the hospital management system.
UML Diagram
Hospital_Management
Server
- sc: Scanner
+ main(args: String[]): void
+ Server()
+ Server1(doctorArr: Doctor[]): void
+ Server2(): Patient
+ Server3(): Management_Staff
+ Server4(userId: int, passWord: int): int
+ Server5(Num: int, employeeArr: Hospital_Employee[]): void
+ Server6(Num: int, employeeArr: Hospital_Employee[]): void
Person
- name: String
- age: int
- gender: String
+ Person()
+ Person(name: String, age: int, gender: String)
+ Details(): void
Patient Hospital_Employee
+ Patient () + Hospital_Employee()
+ Patient(name: String, age: int, gender: String, illness: String ) + Hospital_Employee(name: String, age: int, gender: String)
+ Details(): void + Details(): void
Doctor Management_Staff
- passWord: int
- specialization: String
+ Management_Staff ()
+ Doctor () + Details(): void
+ Doctor(name: String, age: int, gender: String, specialization: String )
+ Doctor(id: int, name: String, age: int, gender: String, specialization: String )
+ Details(): void
package hospital_management;
/**
* @author Easteak
*/
Person()
this.name = name;
this.age = age;
this.gender = gender;
}
return name;
this.name = name;
}
return age;
this.age = age;
return gender;
this.gender = gender;
package hospital_management;
/**
*
* @author Mugdho
*/
Patient()
this.illness = illness;
return illness;
{
System.out.println("Patient Name: " + getName() + "\nAge: " + getAge() + "\n Gender: " + getGender() +
"\n Illness: " + illness);
}
}
package hospital_management;
/**
* @author Mugdho
*/
return id;
{ this.id
= id;
}
Hospital_Employee()
}
package hospital_management;
/**
*
* @author Mugdho
*/
Doctor()
public Doctor(int id, String name, int age, String gender, String specialization)
{
System.out.println("Doctor Name: " + getName() + "\nAge: " + getAge() + "\nGender: " + getGender() +
"\nSpecialization: " + specialization);
String getSpecialization()
{
return specialization;
package hospital_management;
/**
* @author Mugdho
*/
int passWord;
Management_Staff()
public Management_Staff(int id, int passWord, String name, int age, String gender)
}
}
package hospital_management;
* @author Mugdho
*/
Server()
Patient Server2()
{
Management_Staff Server3()
return M1;
return 1;
else
{
return 0;
int id=0; String name; int age; String gender; String specialization;
System.out.print("Enter Doctor\nName:"); name=sc.nextLine();
System.out.print("Age:"); age=sc.nextInt(); sc.nextLine();
System.out.print("Gender:");
gender=sc.nextLine();
System.out.print("Specialization: ");
specialization=sc.nextLine();
System.out.println();
int id=0; int passWord; String name; int age; String gender;
System.out.print("Enter \nName: "); name=sc.nextLine();
System.out.print("Age: "); age=sc.nextInt();
sc.nextLine();
System.out.print("Gender: ");
gender=sc.nextLine();
System.out.print("Id: ");
id=sc.nextInt();
sc.nextLine();
System.out.print("Password: ");
passWord=sc.nextInt();
sc.nextLine();
System.out.println();
}
}
* @author Mugdho
*/
if(press == 1)
S.Server1(doctorArr);
if(doctorArr[i].getSpecialization().equals(P1.getIllness()))
System.out.println();
doctorArr[i].Details();
System.out.println();
found = 1;
}
else if(press == 2)
S.Server5(newE, employeeArr);
System.out.println("Added");
else if(press==2)
S.Server6(newE, employeeArr);
System.out.println("Added");
}
}
else
{
}
}