Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CPSC 1045: Lab 6 [10 Marks] Overview The purpose of today's lab is to create a web application to practice using if else statements and
CPSC 1045: Lab 6 [10 Marks] Overview The purpose of today's lab is to create a web application to practice using if else statements and conditions to make decisions. Instructions: Complete the following exercises individually. Please follow the instructions carefully and complate all of the steps. 1. Reproduce the following himnl page lab6.html. Your HTML page must not have any validation errors. Lab 6 Whicou: lo Le CPSC U4S Lonsy Abplicdicel CCheck Whirtess Dupin here 2. In the same dircctory, create a new lavaScript file calkd lab6 js 3. Inside lab6.js, write the JavaScript to complele the folkswing exercises. a. Create a global variable called lotho that is initialized to 0 . b. When the Generate Number button is pressed, a function shoukd generate a raridern 2-digit number and sel global variable to be this number. c. When the Check My Numbers button is pressed, a function should check to see if the number entered by the uses is vald and if it is a winner. i. The number is valid if it is a 2 digit number 11. The number is a wnner in the followng three scenanos: iii If it matches the btto number in the exact order, the award is $10,000 iv. If both digits in the user input match both digits in the lottery number, but out of order, the award is $3,000. v. If one digit in the user input matches a digit in the lottery number, the averd is $1,000. 4. Test thal your JavaScript correclly execules. Here is some sample culpul. Lab 6 Lab 6 Weleame to the CPSC- 1045 Lamery Applicatioen! Weleame to the CPSC 1045 Lottery Applucation! Click this button to qenernte a radom 2-diait lotiery armber: Click this bution to geserate a rodom 2-digit bosery zumber: Fater yiuir 2-tipil lomery mumber hane. Filer your-2eifgir lemery number here: The nurnber was: 24. Exact maleh! Yeu wia $10000 The number wes 62. Mucchzd both Gigin! You win 33000 Labl 6 Lab 6 Welcouse to the CPSC 1045 Lottery Application! Welocte to toy CPSC 1645 Lotery Application! Click this button to geserate a random 2-digit lottery mumber: Clikk this bulion to yencrske 8 andem 2 -kigit lontery number: Enler your 2-digit lotiery mamber levrvi | Enter your 2-digit Lettery number here: The number was: 51. You masch oae digit You win 31000 The cumber wa:: 30. No matei
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started