From the course: Cloud Native Projects: AWS Serverless

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Solution: Java

Solution: Java

(upbeat music) - [Instructor] And now, it's time for my solution to this problem. I created a new project called java-chal. And I put three classes in there: a request, a response, and a handler. The request is very simple. It takes an integer value that is the count. This was the number of flips that we wanted to execute. My coin toss response is a little bit more complicated. In addition to the flips, and heads, and tails that you might expect, and all of the getters and setters, I added two helper methods: an increment heads and an increment tails just so I could create the object at the beginning and increment it throughout my if statements. So now, let's look at my coin toss handler. And while this may not be the most effective way to do this, it definitely works. So I created the handler and I implemented it using request handler, passing it through request and response. Then we get to line 12. And I…

Contents