import [Link].
InputMismatchException;
import [Link];
public class Main {
static Scanner scanner = new Scanner([Link]);
static class Patient {
String name;
String number;
String address;
void getdata() {
[Link]("\nEnter Patient Name: ");
name = [Link]();
[Link]("Enter Phone Number: ");
number = [Link]();
[Link]("Enter Address: ");
address = [Link]();
void showdata() {
[Link]("\nPatient Name: " + name);
[Link]("Phone Number: " + number);
[Link]("Address: " + address);
static class Doctor {
String name;
String degree;
void getedu() {
[Link]("Enter the Doctor Name: ");
name = [Link]();
[Link]("Enter Doctorate Degree: ");
degree = [Link]();
void showedu() {
[Link]("\nDoctor Name: " + name);
[Link]("Doctorate Degree: " + degree);
static class Appointment {
String name;
String phno;
String address;
String doctorName;
void getapp() {
[Link]("Enter the Patient Name: ");
name = [Link]();
[Link]("Enter Phone Number: ");
phno = [Link]();
[Link]("Enter Address: ");
address = [Link]();
[Link]("Enter Doctor Name: ");
doctorName = [Link]();
[Link]("Appointment made successful.");
}
public static void main(String[] args) {
int username, password;
int cUsername = 0, cPassword = 0;
username = 123;
password = 123;
try {
[Link]("Username: ");
cUsername = [Link]();
[Link]("Password: ");
cPassword = [Link]();
} catch (InputMismatchException e) {
[Link]("Invalid input. Please enter an integer.");
return; // exit the program
if (username == cUsername && password == cPassword) {
int choice;
[Link]("================================================");
[Link]("| Hospital Management System |");
[Link]("| ---------------------------- |");
[Link]("| Press 1 for Edit Patient Details. |");
[Link]("| Press 2 for Edit Doctor Details. |");
[Link]("| Press 3 for Edit Appointment Details. |");
[Link]("================================================");
[Link]("\nEnter the Choice: ");
choice = [Link]();
if (choice == 1) {
Patient patient = new Patient();
int subChoice;
[Link]("=========================================");
[Link]("| Press 1 to enter Patient details |");
[Link]("| Press 2 to view Patient details |");
[Link]("=========================================");
subChoice = [Link]();
if (subChoice == 1) {
[Link]();
} else if (subChoice == 2) {
[Link]();
} else {
[Link]("Invalid entry.");
} else if (choice == 2) {
Doctor doctor = new Doctor();
int subChoice;
[Link]("=========================================");
[Link]("| Press 1 to enter Doctor details |");
[Link]("| Press 2 to view Doctor details |");
[Link]("=========================================");
subChoice = [Link]();
if (subChoice == 1) {
[Link]();
} else if (subChoice == 2) {
[Link]();
} else {
[Link]("Invalid entry.");
}
} else if (choice == 3) {
Appointment appointment = new Appointment();
[Link]();
} else {
[Link]("Invalid entry.");
} else {
[Link]("Invalid username or password.");