Created
April 30, 2019 13:32
-
-
Save jbrains/47e8738bfd87851d0cd8c6041be0f86b to your computer and use it in GitHub Desktop.
A simple example of wiring an application together
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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