Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Interface
  4. {
  5. static Scanner console = new Scanner(System.in);
  6. private Depot depot1 = null;
  7. private Depot depot2 = null;
  8. private int option;
  9.  
  10. public void run()
  11. {
  12. do{
  13. System.out.print("Please enter a number to choose from the provided options below:");
  14. System.out.print("0. Exit!");
  15. System.out.print("1. Create a Depot!");
  16. option = console.nextInt();
  17. switch(option)
  18. {
  19. case 0: break;
  20. case 1: System.out.print("Depot Name");
  21. if (depot1 == null)
  22. {
  23. this.depot1 = new Depot(console.next());
  24. System.out.println(this.depot1.getDepotName());
  25. }
  26. else if (depot2 == null){
  27. String name = console.next();
  28. System.out.println(this.depot1.getDepotName());
  29. if (!name.equals(this.depot1.getDepotName())) {
  30. this.depot2 = new Depot(name);
  31. } else {
  32. System.out.println("Error");
  33. }
  34. }
  35. break;
  36. }
  37. }
  38. while (option!=0);
  39. }
  40. public static void main(String[] args)
  41. {
  42. Interface intFace = new Interface();
  43. intFace.run();
  44. }
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement