Answer to Question #260480 in Java | JSP | JSF for Abbb

Question #260480



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


1
Expert's answer
2021-11-03T00:47:11-0400
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();
	    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS