Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. package util;
  2.  
  3. public class CuiTest {
  4.     private ConsoleUserInterface userInterface;
  5.  
  6.     public CuiTest() {
  7.         userInterface = new ConsoleUserInterface("CuiTest");
  8.  
  9.         CuiCommand testCommand = new TestCommand();
  10.  
  11.         userInterface.addCommand("calculate", testCommand);
  12.     }
  13.  
  14.     public void go() {
  15.         userInterface.start();
  16.     }
  17.  
  18.     public static void main(String[] args) {
  19.         new CuiTest().go();
  20.     }
  21.  
  22.     public class TestCommand implements CuiCommand {
  23.         @Override
  24.         public String getDescription() {
  25.             return "This is just for fun!";
  26.         }
  27.  
  28.         @Override
  29.         public void execute() {
  30.             System.out.println("4 + 8 = " + (4 + 8));
  31.         }
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement