Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need this to be written in HTML/JavaScript Create a web page that simulates a lottery. The JavaScript program will create an array of six

I need this to be written in HTML/JavaScript

Create a web page that simulates a lottery. The JavaScript program will create an array of six numbers between 1 and 40 (inclusive). The numbers will be generated randomly. Be sure to check that the array does not contain duplicates . Sort the array in ascending order. Next, have the user enter the six numbers from an imaginary lottery ticket the user purchased. Sort, if necessary. Check to see how much, if anything, the user has won, using the following table of possible winnings:

image text in transcribed

The page should display the winning number, the users number, the number of matches (if any) and the winnings (if any). Save the page with the filename lottery.html. Submit your work as instructed by your teacher.

There is a sort.js attached with it here is the code given

function bubbleItUp(lgth, arrayName)

{

var flag = 0; var temp = 0;

while (flag == 0)

{

flag = 1;

for (k = 0; k

{

if (arrayName[k] > arrayName[k + 1])

{

temp = arrayName[k];

arrayName[k] = arrayName[k + 1];

arrayName[k + 1] = temp;

flag = 0;

}

}

}

}

function swapIt(a, b)

{

var temp = a;

a = b;

b = temp;

}

Number of Matches Amount of Winnings S 5.00 4 $ 50.00 100.00 100,000.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions