In: Computer Science
Write a program that determines the best possible meeting time for four people. The possibilities for meeting times are 8:00-12:00, 12:00-18:00 or 18:00-23:00.
You should begin by asking the first user to choose a meeting time. The user should enter the number 1 for the 8:00-12:00 meeting time, the number 2 for the 12:00-18:00 meeting time, or the number 3 for the 18:00-23:00 meeting time
Meeting.java
package meeting;
import java.util.Scanner;
public class Meeting {
//static int i;
public static void main(String[] args) {
System.out.println("Enter the
meeting slot for four people : ");
Scanner scan = new
Scanner(System.in);
int i = scan.nextInt();
switch (i) {
case 1:
System.out.println("The meeting time is : " + "8:00 -
12.00");
break;
case 2:
System.out.println("The meeting time is : " + "12:00 -
18.00");
break;
case 3:
System.out.println("The meeting time is : " + "18:00 -
23.00");
break;
default:
System.out.println(" Please enter the correct slot number between 1
to 3?");
break;
}
scan.close();
}
}
Output:
case 1:
Enter the meeting slot for four people :
1
The meeting time is : 8:00 - 12.00
case2:
Enter the meeting slot for four people :
2
The meeting time is : 12:00 - 18.00
case3:
Enter the meeting slot for four people :
3
The meeting time is : 18:00 - 23.00
default case:
Enter the meeting slot for four people :
4
Please enter the correct slot number between 1 to 3?