Skip to content

Instantly share code, notes, and snippets.

@jbrains
Created April 30, 2019 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbrains/47e8738bfd87851d0cd8c6041be0f86b to your computer and use it in GitHub Desktop.
Save jbrains/47e8738bfd87851d0cd8c6041be0f86b to your computer and use it in GitHub Desktop.
A simple example of wiring an application together
package ca.jbrains.pos;
import ca.jbrains.pos.ui.TextProcessorAndCommandInterpreter;
import ca.jbrains.pos.ui.lcd.UdpPostOffice;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
public class VirtualPointOfSaleTerminal {
public static void main(String[] args) throws IOException {
TextProcessorAndCommandInterpreter textProcessorAndCommandInterpreter = new TextProcessorAndCommandInterpreter(
new SaleController(
new InMemoryCatalog(
new HashMap<String, Price>() {{
put("12345", Price.cents(795));
put("23456", Price.cents(1250));
put("036000216066", Price.cents(379));
}}
),
new EnglishLanguageTextDisplay(
new UdpPostOffice("localhost", 5358, "UTF-8"))
)
);
textProcessorAndCommandInterpreter.process(
new InputStreamReader(System.in)
):
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment