Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: Perform all of the requested tasks given below. Description: You are required to build a Game of Chance which mirrors the Jamaican childhood

image text in transcribed

Instructions: Perform all of the requested tasks given below. Description: You are required to build a Game of Chance which mirrors the Jamaican childhood game 'Ship Sail! Ship Sail! 'Ow much man deh pon board? (How many men on board)' that was played with roast corn. In this game Player 1 would have some corn kernels in their hand and Player 2 must guess the correct amount of corn kernels held. If Player 2 guesses correctly, he/she would get the kernels from Player 1 to be added to their own bounty. If they guess incorrectly they would have to give Player 1 the amount of kernels equivalent to what Player 1 had in their hand. The game is played until either player choose to quit or either player has no corn kernels left. You are required ... For this game the user will be playing against the computer. At the start of the game, each player (Computer and user) bounty is 100 corn kernels each. The website will automatically generate a number less than the amount of corn kernels that the computer has (This must not be displayed). The user must be allowed to enter the number that he/she believes to be the correct amount of corn kernels the computer has into the website. Game data such as the player's name, date of birth, gender, all the responses from the player, along with an indicator for each of the correct and incorrect answers. The website should display the user's name, total corn kernels won, total corn kernels lost as well as the percentage score for correct answers. The user interface must be organized into 3 sections: (1) Registration, (2) Play, and (3) Results areas. Task 1: (6 marks) Create a new HTML page called index.html. There is to be a form on the web page with the following fields for entering information on each player: User Name, DOB, Email, Age and Gender. i) All fields are required to have the correct entry value. ii) All fields are required to have a unique id. iii) Age must be calculated by the system from date of birth and must be greater than 5. iv) Usernames must be more than three (3) characters in length. v) Email address must be validated to only accept email addresses that end with "@gmail.com". vi) All validations are to be done via HTML tag attributes. 1 Task 2: (8 marks) Create a JavaScript function called Register() that will accept the values entered in the fields listed above, validate all entries using JavaScript validations, and then append the validated content to a global JavaScript array called PlayersData[]. Note that the array must be global for other functions to access it. Task 3: (4 marks) 2 Add a button, called Register to the entry form created in Task 1 and ensure that this button calls Register() from Task 2 whenever it is clicked. After the Register button is clicked, all the fields from Task 1 above and Register button must be disabled, additionally a Quit button, (from Task 10) along with the Play (from Task 5) must now be enabled. Task 4: (15 marks) Create a JavaScript function called PlayGame() that will randomly generate an integer number from 1 to the value of the Computer's bounty to represent the number of corn kernels the computer is holding in its 'hand'. It should show the message "SHIP SAIL, SHIP SAIL, 'OW MUCH MAN DEH PON BOARD!' Player 1 is then asked to guess the amount of corn kernels the computer has by entering a value representing it's guess then clicking a Guess button. Player I's guess should not be greater than the totalCorn value that he/she has. Validate all entries using JavaScript validations. Please Note: Initially, Player I's bounty and the computer's bounty are global variables and should be set to 100.

Step by Step Solution

3.39 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Define Heideggers terms throwness, Mitwelt, and Umwelt.

Answered: 1 week ago