Advertisement
Guest User

Untitled

a guest
May 21st, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7. new Scanner(System.in);
  8. Buildings[] b = new Buildings[3];
  9. for (int i = 0; i <3; i++)
  10. b[i] = new Buildings();
  11.  
  12. Scanner sc = new Scanner(System.in);
  13. System.out.println("What do u looking for?");
  14. System.out.println("1. Stracts; \n 2.Check Info for number of shop");
  15. int choice = sc.nextInt();
  16.  
  17. switch (choice){
  18. case 1:
  19. for (int i = 0; i <3; i++) {
  20. System.out.println(b[i].number);
  21. b[i].Info();
  22. System.out.println("\n");
  23. }
  24. break;
  25. case 2:
  26. while (true) {
  27. System.out.println("Input shop number");
  28. System.out.printf("1. %d \n2. %d \n3. %d \n4. EXIT", b[0].number, b[1].number, b[2].number);
  29. int choose = sc.nextInt();
  30. if (choose == 4)
  31. break;
  32. else {
  33. choose -= 1;
  34. System.out.println(b[choose].number);
  35. b[choose].Info();
  36. }
  37. }
  38. break;
  39. }
  40.  
  41. }
  42. }
  43. ___________________________________________________________________________________________________________________
  44. package com.company;
  45.  
  46. import java.util.Scanner;
  47.  
  48. public class Buildings {
  49. int number;
  50. Sellers[] s = new Sellers[1];
  51.  
  52. public Buildings() {
  53. System.out.println("Input Building number");
  54. Scanner sc = new Scanner(System.in);
  55. number = sc.nextInt();
  56.  
  57. for (int i = 0; i <1; i++)
  58. s[i] = new Sellers();
  59.  
  60. }
  61. public void Info(){
  62. for (int i = 0; i <1; i++) {
  63. System.out.println(s[i].name);
  64. s[i].Info();
  65. }
  66. }
  67.  
  68.  
  69. }
  70. ___________________________________________________________________________________________________________
  71.  
  72. package com.company;
  73.  
  74. import java.util.Scanner;
  75.  
  76. public class Sellers {
  77. String name;
  78. Products[] p = new Products[1];
  79. Sellers() {
  80. System.out.println("Input Seller name");
  81. Scanner sc = new Scanner(System.in);
  82. name = sc.nextLine();
  83.  
  84. for (int i = 0; i <1; i++)
  85. p[i] = new Products();
  86. }
  87. public void Info(){
  88. for (int i = 0; i <1; i++) {
  89. System.out.println(p[i].name);
  90. p[i].Info();
  91. }
  92. }
  93.  
  94. }
  95. ___________________________________________________________________________________________
  96.  
  97. package com.company;
  98.  
  99. import java.util.Scanner;
  100.  
  101. public class Products {
  102. String name;
  103. Delivers[] d = new Delivers[1];
  104.  
  105. Products() {
  106. System.out.println("Input Product ");
  107. Scanner sc = new Scanner(System.in);
  108. name = sc.nextLine();
  109.  
  110. for (int i = 0; i < 1; i++)
  111. d[i] = new Delivers();
  112.  
  113. }
  114. public void Info(){
  115. for (int i = 0; i < 1; i++)
  116. System.out.println(d[i].name);
  117. }
  118. }
  119. ___________________________________________________________________________________________________________
  120.  
  121. package com.company;
  122.  
  123. import java.util.Scanner;
  124.  
  125. public class Delivers {
  126. String name;
  127.  
  128. Delivers() {
  129. System.out.println("Input Deliver name");
  130. Scanner sc = new Scanner(System.in);
  131. name = sc.nextLine();
  132. }
  133. }
  134. _____________________________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement