School of Electrical Engineering and Computer ScienceThe University of NewcastleSENG2050/SENG6050 Introduction to Web EngineeringAssignment 2 (15%) – Semester 1, 2021Due: Saturday 1st May 2021 11:59PMDeal or No Deal1. IntroductionThe main objective of this assignment is to implement an online version of the game – Deal or NoDeal. The original rules for the game can be found on the web (for example,https://en.wikipedia.org/wiki/Deal_or_No_Deal_(Australian_game_show)). In this implementationwe will simplify the game to make it more suitable for online play. Following are the (modified)game rules.There are 12 briefcases which are numbered 1through 12. Each briefcase contains a unique monetaryamount from the following figures: $0.5, $1, $10, $100, $200, $500, $1000, $2000, $5000, $10000,$20000, $50000. The contestant is asked to nominate a number of cases (4 for the first round, 3 forthe second round, 2 cases in the third round, 1 for round 4, and 1 for round 5) to be opened so that themonetary amount in those cases can be revealed.The aim of the player is to hopefully not reveal the larger cash prizes. At the end of each round (forthe first 4 rounds) – the “bank” will offer the contestant a monetary amount to try and convince themto make a “deal” and quit the game at that point. The amount offered is based on the followingformula: the total amount of the money in the remaining cases divided by the number of casesremaining. If the contestant believes that they are in possession of big bucks or that the bank offer isnot worth considering – they will choose “no deal” and the game will move on to another round.After the 5th round, there is a single briefcase remaining, the monetary amount contained in thebriefcase is the prize the contestant gets.The first page that is presented to the user will allow them to start a new game or load an existinggame (see below). When a user starts a new game, the website will display 12 briefcases (randomlyordered) and allows the user to click on a briefcase to reveal the monetary amount in those cases.You will also display how many briefcases are yet to be opened in the current round. At the end ofeach round the user will be shown a page displaying the amount the bank is offering together withthe largest amount unrevealed in the current stage. There should be an option of “deal” or “no deal”on the page. If the user chooses “deal”, the game finishes. If the user chooses “no deal”, they willmove onto next round.After selecting “no deal” the user will be given the option to save their game. The game’s stateshould be saved in a Microsoft SQL database accessed through JDBC. This will be saved by theserver (to prevent cheating). Each saved game will be referenced by a username and passphraseprovided by the user. Each user may have a single saved game, i.e. starting a new game with anexisting username will replace the save game data. But the user must provide the correct passphrasebefore resuming or replacing an existing game. Saving the game should end the current game, andreturn the user to the new game screen. When loading a game, it should clear the saved data from thedatabase. This is to prevent a user from reloading their game if they are unhappy with their selection.Finally, the user’s game should be automatically saved and closed after 5 minutes of inactivity.To make this game practical, you will need to make sure:• It is multi-user safe.• Clicking the browser’s “refresh” button will not result in any inconsistencies such as abriefcase being opened twice, the user is asked to rethink the bank’s offer, etc.• Clicking the browser’s “back” button will not roll back the game.• Inspecting the game pages will not expose case values.In this assignment, you should use JSPs and Java Servlets together with JavaBeans in a MVCcompliant manner.2. SubmissionYou should create a zip file called cXXXXXXX_assignment2 (where XXXXXXX is your studentnumber) with the following files and submit it through blackboard:1. Assignment Cover Sheet.2. A brief explanation of your program (readme.txt).• The application’s structure, i.e. relationships among objects etc.• What is the purpose of each of your objects?• How did you implement storing game state?• How did you implement game saving?• The URL the marker needs to visit to start the application.3. Your entire application. This should include all the files that contribute to your web pages,including HTML, java source code, and images, etc; as well as the SQL script to create your database.For this assignment, your application will use a JDBC Data Source named ‘jdbc/dealdata’. Duringdevelopment your data source will be defined in the application’s context.xml file. Include a copy ofyour context.xml file in the root directory of your submission. BUT DO NOT SUBMIT IT IN THEMETA-INF directory. We will use a server-wide data source for marking. Please ensure you includeyour SQL database creation script.Your application will be tested in Tomcat 9 and compiled with JDK 11, please use relative addresses(no host name) in your program rather than absolute addresses. Your application should work whendeployed to Tomcat’s webapps directory with the name cXXXXXXX_assignment2 (whereXXXXXXX is your student number) i.e. apache-tomcat/webapps/cXXXXXXX_assignment2/ andhttp://localhost:8080/cXXXXXXX_assignment2/3. Marking GuidelinesThe following is a general guide on how the marks are allocated to each part of the assignment andsome common mistakes where you might lose marks. Total marks: 90HTML and CSS: 10• Is your HTML syntax valid (use a validator)?• Do your tags make semantic sense?• Are you using tags just for their visual effect?• Are you using CSS to advise the browser about visual formatting?JSP: 20• Is your JSP syntax valid?• Are you overloading your JSP with too much Java code?• Is your JSP nicely formatted and commented?Java Beans: 10• Does your “bean” conform to the Java Beans standard?• Is your bean shared among the pages correctly?• Does your bean contain HTML output or request processing logic?• Is your Java nicely formatted and commented?Servlets and MVC: 10• Is your application designed using MVC?• Do your servlets implement business logic or page generation?• Can your servlets handle errors properly?• Are your servlets nicely formatted and commented?Saving Games: 10• Are your games stored in a SQL database?• Are you closing database connections after use?• Is your application vulnerable to SQL injection attacks?o Hint: Use prepared statements for parameterised queries.Session Tracking and Thread Safe: 10• Can each user play a different game in parallel?• Is your application thread safe?Requirements: 20• Does your assignment meet the specifications above?Usability: 10
