Advertisement
Guest User

attachment 1

a guest
Jun 21st, 2021
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class ServiceCenterExample {
  3.     public static void main(String[] args) {
  4.         Scanner input = new Scanner(System.in);
  5.         String customerName;
  6.         int tokenNum;
  7.         String agentName;
  8.         int boothNum =0;
  9.         String[] ServiceCenter = new String[7];
  10.         //for (int x = 0; x < 6; x++ ) hotel[x] = ""; //initialise
  11.         initialise(ServiceCenter); //better to initialise in a procedure
  12.         while ( boothNum < 6 )
  13.         {
  14.             for (int x = 0; x < 6; x++ )
  15.             {
  16.                 if (ServiceCenter[x].equals("e"))System.out.println("booth " + x + " is empty");
  17.             }
  18.             System.out.println("Enter booth number (0-5) or 6 to stop:" );
  19.             boothNum = input.nextInt();
  20.             System.out.println("Enter customer name for booth " + boothNum +" :" ) ;
  21.             customerName = input.next();
  22.             ServiceCenter[boothNum] = customerName ;
  23.             for (int x = 0; x < 6; x++ )
  24.             {
  25.                 System.out.println("booth " + x + " occupied by " + ServiceCenter[x]);
  26.             }
  27.         }
  28.     }
  29.     private static void initialise( String hotelRef[] ) {
  30.         for (int x = 0; x < 6; x++ ) hotelRef[x] = "e";
  31.         System.out.println( "initilise ");
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement