Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Create a function that when startBtn is clicked, it looks at the chosen radio in (1), (easy and hard either can be chosen) and if the easy is chosen the parameter for addTable (2) is EASY[getRandomNumber()] and if it is hard then HARD[getRandomNumber()]
1.
<div class="flex justify-center space-x-4 border p-4 rounded-md">
<labelclass="difficulty-option">
<inputtype="radio"name="difficulty"value="easy"class="hidden"/>
<spanclass="difficulty-button">5 x 5 (Easy)</span>
</label>
<labelclass="difficulty-option">
<inputtype="radio"name="difficulty"value="hard"class="hidden"/>
<spanclass="difficulty-button">7 x 7 (Hard)</span>
</label>
</div>
3.
There are arrays called EASY, HARD
2.
function addTable(matrix) {
consttable=document.createElement("table");
for (leti=0; i<matrix.length; i++) {
constrow=document.createElement("tr");
for (letj=0; j<matrix[i].length; j++) {
constcell=document.createElement("td");
constimg=generator(matrix[i][j]);
cell.appendChild(img);
row.appendChild(cell);
}
table.appendChild(row);
}
map.appendChild(table);
}
startBtn.addEventListener('click', startGame)
// HELPER FUNCTIONS
function startGame(){
menuDiv.style.display='none'
gameDiv.style.display='block'
rulesDiv.style.display='none'
ldrDiv.style.display='none'
document.querySelector('#name').innerHTML="ROUTE DESIGNER: "+nameInput.value
startTime=Date.now();
timerInterval=setInterval(updateTimer, 1000);
}
function getRandomNumber() {
returnMath.floor(Math.random() *5);
}
SAVE
AI-Generated Solution
info
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
Unlock instant AI solutions
Tap the button
to generate a solution
to generate a solution
Click the button to generate
a solution
a solution
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- The question is on the attached image. grayscale function code: from images import Image def grayscale1(image): """Converts an image to grayscale using the psychologically accurate transformations.""" for y inrange(image.getHeight()): for x inrange(image.getWidth()): (r, g, b) = image.getPixel(x, y) r = int(r * 0.299) g = int(g * 0.587) b = int(b * 0.114) lum = r + g + b image.setPixel(x, y, (lum, lum, lum))arrow_forwardThe code given below represents a saveTransaction() method which is used to save data to a database from the Java program. Given the classes in the image as well as an image of the screen which will call the function, modify the given code so that it loops through the items again, this time as it loops through you are to insert the data into the salesdetails table, note that the SalesNumber from the AUTO-INCREMENT field from above is to be inserted here with each record being placed into the salesdetails table. Finally, as you loop through the items the product table must be update because as products are sold the onhand field in the products table must be updated. When multiple tables are to be updated with related data, you should wrap it into a DMBS transaction. The schema for the database is also depicted. public class PosDAO { private Connection connection; public PosDAO(Connection connection) { this.connection = connection; } public void…arrow_forwardComputer Science Use only NumPy to create the Normalize Class: Image Normalization is a technique used to touch up images that are too dark or too light for the human viewing experience. Implement a version that outputs images with full dynamic range (0–255 pixel intensity). In other words, for each color channel (r, g, b), rescale the range of pixel values for that channel to include both 0 and 255. After normalizing, there should be at least one pixel with a red value of 0, at least one pixel with a red value of 255, at least one pixel with a green value of 0, etc. To normalize a list of numbers nums to the range 0–n, set nums[i] = (nums[i]−min(nums))/(max(nums)−min(nums))∗n for all i. Be careful! When max(nums) == min(nums), you should not touch that list (why?).arrow_forward
- In the language R: Which of the following statements is NOT correct about drawing a map in R? Select one: A. When drawing a map, we use the geom_polygon() function to plot a set of lines drawn in the right order on a grid B. The scale_fill_gradient() function allows us to define different gradient colors for lower or higher numerical values C. We cannot change the filling colors manually when drawing a map D. We use the “Albers Projection” to project points and lines from a round to a flat surfacearrow_forwardjavascript Need help defining a function frequencyAnalysis that accepts a string of lower-case letters as a parameter. frequencyAnalysis should return an object containing the amount of times each letter appeared in the string. example frequencyAnalysis('abca'); // => {a: 2, b: 1, c: 1}arrow_forward3. Card Flipper: You walk into a room, and see a row of n cards. Each one has a number x; written on it, where i ranges from 1 to n. However, initially all the cards are face down. Your goal is to find a local minimum: that is, a card i whose number is less than or equal to those of its neighbors, xj-1 = X; <= Xj+1. The first and last cards can also be local minima, and they only have one neighbor to compare to. There can be many local minima, but you are only responsible for finding one of them. Obviously you can solve this problem by turning over all n cards, and scanning through them. However, show that you can find such a minimum by turning over only O(log n) cards.arrow_forward
- Draw a wall with "irregular wavy color bands". Hint: you can use curveVertex and random functions in p5js library. Note: You should use loops to draw the lines, not manually write 50-100 line functions How would i answer this question using the code below: function setup() { createCanvas(350, 350); } function draw() { background(200); background('blue'); noFill(); //this will run a loop form -20 to fill the whole canvas for(let y=-20; y<300; y+=4){ beginShape(); Stroke("yelllow"); //now to link point to point in curve //y is height curveVertex(0, y+0); curveVertex(0, y+20); curveVertex(50, y+0); curveVertex(100, y+20); curveVertex(150, y+0); curveVertex(200, y+20); curveVertex(250, y+0); curveVertex(300, y+20); curveVertex(350, y+0); curveVertex(400, y+0); endShape(); } } Subject: Java Programmingarrow_forwardin c++ codearrow_forwardWritten in Python with docstring please if applicable Thank youarrow_forward
- 1. Create a UML using the UML Template attached. 2. In this lab, you will be creating a roulette wheel. The pockets are numbered from 0 to 36. The colors of the pockets are as follows: Pocket 0 is green. For pockets 1 through 10, the odd-numbered pockets are red and the even-numbered pockets are black. For pockets 11 through 18, the odd-numbered pockets are black and the even-numbered pockets are red. For pockets 19 through 28, the odd-numbered pockets are red and the even-numbered pockets are black. For pockets 29 through 36, the odd-numbered pockets are black and the even-numbered pockets are red. Create a class named RoulettePocket. The class's constructor should accept a pocket number. The class should have a method named getPocketColor that returns the pocket's color, as a string. Demonstrate the class in a program that asks the user to enter a pocket number, and displays whether the pocket is green, red, or black. The program should display an error message if the user…arrow_forwardComplete the drawTriangle() function in script.js that draws a triangle with asterisks (*) based on the triangleSize parameter. Ex: drawTriangle(4) outputs to the console a triangle with triangleSize 4, so the longest side (4 asterisks) appears on the bottom line: * ** *** **** Hint: Use a loop inside a loop to complete drawTriangle(). The outer loop is responsible for outputting each asterisk line, and the inner loop is responsible for building the asterisk line with the appropriate length by concatenating asterisks to a single string. To test the JavaScript in your web browser, call drawTriangle() from the JavaScript console.arrow_forwardJava codearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education