Question: Q1 A Class Player with the following attributes and validation annotations String name // 2
Q1
A Class Player with the following attributes and validation annotations String name // 2<=name<=40 (length) Integer age // min(18) List games
A Class Game with the following attributes String title Integer difficulty // min(1)
[10] Q2
A class PlayerDb that.. - stores a List of Players e.x [ { name : joe bob age : 22 games : [] }, { name : sue age : 24 games : [{title : battle toads, difficulty : 10}] }, { name : jane age : 18 games : [{title : I want to be the boshy, difficulty : 11},{title : Mario, difficulty : 4}] } ]
- has a method to fetch a player by name (using streams) and return null if none is found
input : joe bob output { name : joe bob age : 22 games : [] } - has a method to fetch all players with atleast y age and own atleast one game that's x difficulty (using streams)
input age 18, difficulty 11 output { name : jane age : 18 games : [{title : I want to be the boshy, difficulty : 11},{title : Mario, difficulty : 4}] }
- has a method that fetches the game with the highest difficulty(using streams)
input output: {title : I want to be the boshy, difficulty : 11}
- has a method to fetch all players - has a method to add a player
- no points for not using streams
[5] Q3
A Controller MainController that - has a playerDB class injected into it - has a mapping for "/players" that returns a 'players' template and attaches all players to the model
A Controller GameRestController that - has a playerDB class injected into it - has a mapping for "/mostdifficult" that returns the game with the highest difficulty
[10] Q4
[MainController] A path get "/create" that returns a template with a form to create a player A template using thymeleaf that is an html5 form to create a player (and games they own) and submits a post to "/create" - form should display validation errors if any [MainController] A path post "/create" that saves a player (to playerdb) if it passes validation or returns back the original form if there are errors
[4] Q5
A template players.html that - displays all players and their age and number of games owned - at the bottom of the page show the most difficult game, and keep it refreshed with ajax every 2 seconds
=== A new class named ExamQuestions that has the following static methods ===
[4] Q6
A recursive function that takes in a List numbers and recursively sums up the values
Example
Input : [1,2,3,4,5,6,7,8,9] Output : 45 Note - [-3] points for using a loop on this question
[6] Q7
A recursive function that takes in a number N, and checks to see if its a prime number (not divisible by anything but 1 and itself)
example input 7 => true 17 => true 4 => false
[5] A unit test for Q3 (unit test must validate the /players method that it attaches the correct objects to the model and returns the correct template) [3] A unit test for Q6 (recursive question)
[7] A unit test for Q2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
