0% found this document useful (0 votes)
47 views

Patient Info Java OOP Code

The document defines a Patient Info class with fields to store a patient's name, age, doctor name, and appointment time. It includes methods to get an appointment, display appointment details, insert patient info, and display patient info. The main method prompts a user for a patient's name, age, doctor, and time, creates a Patient Info object, calls the insert and get appointment methods, and then displays the patient and appointment info.

Uploaded by

Wasif Hassan
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)
47 views

Patient Info Java OOP Code

The document defines a Patient Info class with fields to store a patient's name, age, doctor name, and appointment time. It includes methods to get an appointment, display appointment details, insert patient info, and display patient info. The main method prompts a user for a patient's name, age, doctor, and time, creates a Patient Info object, calls the insert and get appointment methods, and then displays the patient and appointment info.

Uploaded by

Wasif Hassan
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
You are on page 1/ 2

public class {

Patient Info {

String name;

Int age;

String doctorName;

int time;

void getAppointment (String d, int t){

doctorName = d;

time = t;

void displayAppointment () {

System.out.println("Patient's Appointment to Dr “ + doctorName);

System.out.println("The time of Appointment is: “ +time);

void insertInfo( String n, int a){

name = n;

age = a;

void displayInfo() {

System.out.println("Name of patient is: name);

System.out.println("Age of patient is: + age);

}}}}

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

Patient _Info patient = new Patient_Info();

System.out.println("Enter Patient's name: ");

patient.name = input.nextLine();

System.out.println("Enter Patient's age: ");


patient.age = input.nextInt();

System.out.println("Which doctor do you have appointment with? ");

patient.doctorName = input.next();

System.out.println("Enter Appointment time: ");

patient.time = input.nextInt();

patient insertInfo(patient.name, patient.age);

patient.getAppointment (patient.doctorName , patient.tine);

patient.displayInfo();

patient.displayAppointment();

You might also like