Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Interface
- {
- static Scanner console = new Scanner(System.in);
- private Depot depot1 = null;
- private Depot depot2 = null;
- private int option;
- public void run()
- {
- do{
- System.out.print("Please enter a number to choose from the provided options below:");
- System.out.print("0. Exit!");
- System.out.print("1. Create a Depot!");
- option = console.nextInt();
- switch(option)
- {
- case 0: break;
- case 1: System.out.print("Depot Name");
- if (depot1 == null)
- {
- this.depot1 = new Depot(console.next());
- System.out.println(this.depot1.getDepotName());
- }
- else if (depot2 == null){
- String name = console.next();
- System.out.println(this.depot1.getDepotName());
- if (!name.equals(this.depot1.getDepotName())) {
- this.depot2 = new Depot(name);
- } else {
- System.out.println("Error");
- }
- }
- break;
- }
- }
- while (option!=0);
- }
- public static void main(String[] args)
- {
- Interface intFace = new Interface();
- intFace.run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement