Write a main program to:
Create two different appointment. The first appointment object is for patient “MayaMroueh” on “Thursday” at “13 pm”. The second appointment object is read from the user.
Write the code to check if the two appointments conflict in day and time. If so it prints a message “The two appointments are set for the same day and day”. And moves one of the appointments to the next day.
Write the code to display the appointments information using the method getApprointmentDetails
import java.util.Scanner;
public class Main
{
static void getApprointmentDetails(){
Scanner input=new Scanner(System.in);
String S="Thursday 13pm";
System.out.println("Enter the appointment day and time: ");
String time=input.nextLine();
if(S.equals(time)){
System.out.println("The two appointments are set for the same day and time");
System.out.print("Please come the next day on Friday 13pm");
}
else{
System.out.print("The first appointment is on Thursday 13pm");
System.out.print(" while the second appointment is on "+time);
}
}
public static void main(String[] args){
getApprointmentDetails();
}
}
Comments
Leave a comment