lab24
subdirectory of your personal repo, the other submits a file report.txt
in the lab24
subdirectory of your personal repo.bin
directory to PATH
:
export PATH=$PATH:~/activator-1.3.12-minimal/bin
activator new lab24 play-java
cd lab24 activator run
localhost:9000
. You should see a welcome screen. Hit Ctrl+C when done.project/plugins.sbt
and add the line
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")after the other
addSbtPlugin
commandsactivator eclipsein the
lab24
directorylab24
directory.~/activator-1.3.12-minimal/bin/activator run
in a terminal window.http://localhost:9000/select/lesson24q1/CTo do that, you need to
conf/routes
fileHomeController
class:
public Result select(String problem, String choice) { return ok("You selected " + choice + " for " + problem + "\n").as("text/plain"); }
http://localhost:9000/select/lesson24q1/C
. What happens?conf/routes
so that your method gets called. What did you do?http://localhost:9000/select/lesson24q1/C
HomeController
:
private static HashMap<String, HashMap<String, Integer>> results = new HashMap<>();In the
select
method, add this code before the return
statement:
results.compute(problem, (k, v) -> v == null ? new HashMap<>() : v) .compute(choice, (k, v) -> v == null ? 1 : v + 1);What does the code do?
public Result view(String question)
that yields the map of counts for the given question. What is your method?http://localhost:9000/select/lesson24q1/C http://localhost:9000/select/lesson24q1/A http://localhost:9000/select/lesson24q1/B http://localhost:9000/select/lesson24q1/C http://localhost:9000/view/lesson24q1What happens?