Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- new Scanner(System.in);
- Buildings[] b = new Buildings[3];
- for (int i = 0; i <3; i++)
- b[i] = new Buildings();
- Scanner sc = new Scanner(System.in);
- System.out.println("What do u looking for?");
- System.out.println("1. Stracts; \n 2.Check Info for number of shop");
- int choice = sc.nextInt();
- switch (choice){
- case 1:
- for (int i = 0; i <3; i++) {
- System.out.println(b[i].number);
- b[i].Info();
- System.out.println("\n");
- }
- break;
- case 2:
- while (true) {
- System.out.println("Input shop number");
- System.out.printf("1. %d \n2. %d \n3. %d \n4. EXIT", b[0].number, b[1].number, b[2].number);
- int choose = sc.nextInt();
- if (choose == 4)
- break;
- else {
- choose -= 1;
- System.out.println(b[choose].number);
- b[choose].Info();
- }
- }
- break;
- }
- }
- }
- ___________________________________________________________________________________________________________________
- package com.company;
- import java.util.Scanner;
- public class Buildings {
- int number;
- Sellers[] s = new Sellers[1];
- public Buildings() {
- System.out.println("Input Building number");
- Scanner sc = new Scanner(System.in);
- number = sc.nextInt();
- for (int i = 0; i <1; i++)
- s[i] = new Sellers();
- }
- public void Info(){
- for (int i = 0; i <1; i++) {
- System.out.println(s[i].name);
- s[i].Info();
- }
- }
- }
- ___________________________________________________________________________________________________________
- package com.company;
- import java.util.Scanner;
- public class Sellers {
- String name;
- Products[] p = new Products[1];
- Sellers() {
- System.out.println("Input Seller name");
- Scanner sc = new Scanner(System.in);
- name = sc.nextLine();
- for (int i = 0; i <1; i++)
- p[i] = new Products();
- }
- public void Info(){
- for (int i = 0; i <1; i++) {
- System.out.println(p[i].name);
- p[i].Info();
- }
- }
- }
- ___________________________________________________________________________________________
- package com.company;
- import java.util.Scanner;
- public class Products {
- String name;
- Delivers[] d = new Delivers[1];
- Products() {
- System.out.println("Input Product ");
- Scanner sc = new Scanner(System.in);
- name = sc.nextLine();
- for (int i = 0; i < 1; i++)
- d[i] = new Delivers();
- }
- public void Info(){
- for (int i = 0; i < 1; i++)
- System.out.println(d[i].name);
- }
- }
- ___________________________________________________________________________________________________________
- package com.company;
- import java.util.Scanner;
- public class Delivers {
- String name;
- Delivers() {
- System.out.println("Input Deliver name");
- Scanner sc = new Scanner(System.in);
- name = sc.nextLine();
- }
- }
- _____________________________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement