— **Question:** You are tasked with creating a function in JavaScript that dyn


**Question:**
You are tasked with creating a function in JavaScript that dyn


**Question:**
You are tasked with creating a function in JavaScript that dynamically generates a complex DOM structure, including nested elements with specific attributes and styles. Additionally, this function should open a new window, clone the generated DOM structure, and insert it into the new window’s document.
Implement the `createAndCloneDOM` function which accomplishes the following:
1. Creates a `div` element with an id of `container`.
2. Within this `div`, create a nested structure:
– An `h1` element with the text “Main Title”.
– A `p` element with the text “This is a paragraph.” and a class name `intro`.
– An `ul` element containing three `li` elements with the text “Item 1”, “Item 2”, and “Item 3”.
3. Styles the `div` with a border of `2px solid black` and padding of `10px`.
4. Appends this `div` to the `body` of the current document.
5. Opens a new window, clones the entire `div` structure, and inserts it into the new window’s document.
Which of the following options correctly implements the `createAndCloneDOM` function?
**Options:**
A)
“`javascript
function createAndCloneDOM() {
let container = document.createElement(‘div’);
container.id = ‘container’;
let title = document.createElement(‘h1’);
title.textContent = ‘Main Title’;
container.appendChild(title);
let paragraph = document.createElement(‘p’);
paragraph.textContent = ‘This is a paragraph.’;
paragraph.className = ‘intro’;
container.appendChild(paragraph);
let list = document.createElement(‘ul’);
for (let i = 1; i <= 3; i++) { let listItem = document.createElement('li'); listItem.textContent = `Item ${i}`; list.appendChild(listItem); } container.appendChild(list); container.style.border = '2px solid black'; container.style.padding = '10px'; document.body.appendChild(container); let newWindow = window.open('', '', 'width=400,height=300'); newWindow.document.body.appendChild(container.cloneNode(true)); } ``` B) ```javascript function createAndCloneDOM() { let container = document.createElement('div'); container.id = 'container'; let title = document.createElement('h1'); title.textContent = 'Main Title'; container.appendChild(title); let paragraph = document.createElement('p'); paragraph.textContent = 'This is a paragraph.'; paragraph.className = 'intro'; container.appendChild(paragraph); let list = document.createElement('ul'); for (let i = 1; i <= 3; i++) { let listItem = document.createElement('li'); listItem.textContent = `Item ${i}`; list.appendChild(listItem); } container.appendChild(list); container.style.border = '2px solid black'; container.style.padding = '10px'; document.body.appendChild(container); let newWindow = window.open('', '', 'width=400,height=300'); newWindow.document.write('

‘ + container.innerHTML + ‘

‘);
newWindow.document.close();
}
“`
C)
“`javascript
function createAndCloneDOM() {
let container = document.createElement(‘div’);
container.id = ‘container’;
let title = document.createElement(‘h1’);
title.textContent = ‘Main Title’;
container.appendChild(title);
let paragraph = document.createElement(‘p’);
paragraph.textContent = ‘This is a paragraph.’;
paragraph.className = ‘intro’;
container.appendChild(paragraph);
let list = document.createElement(‘ul’);
for (let i = 1; i <= 3; i++) { let listItem = document.createElement('li'); listItem.textContent = `Item ${i}`; list.appendChild(listItem); } container.appendChild(list); container.style.border = '2px solid black'; container.style.padding = '10px'; document.body.appendChild(container); let newWindow = window.open('', '', 'width=400,height=300'); let newDoc = newWindow.document; newDoc.open(); newDoc.write('New Window‘);
newDoc.write(container.outerHTML);
newDoc.write(‘‘);
newDoc.close();
}
“`
D)
“`javascript
function createAndCloneDOM() {
let container = document.createElement(‘div’);
container.id = ‘container’;
let title = document.createElement(‘h1’);
title.textContent = ‘Main Title’;
container.appendChild(title);
let paragraph = document.createElement(‘p’);
paragraph.textContent = ‘This is a paragraph.’;
paragraph.className = ‘intro’;
container.appendChild(paragraph);
let list = document.createElement(‘ul’);
for (let i = 1; i <= 3; i++) { let listItem = document.createElement('li'); listItem.textContent = `Item ${i}`; list.appendChild(listItem); } container.appendChild(list); container.style.border = '2px solid black'; container.style.padding = '10px'; document.body.appendChild(container); let newWindow = window.open('', '', 'width=400,height=300'); newWindow.document.body.innerHTML = container.outerHTML; } ``` **Correct Answer:** A) Explanation: Option A correctly implements the function by creating the necessary DOM structure, styling it, appending it to the body, and then cloning the `div` and appending the cloned node to the new window's document body. This approach ensures that the entire structure, including event listeners and styles, is properly duplicated in the new window.

In this assignment we will simulate the kind ofprocessing you will do next semes

In this assignment we will simulate the kind ofprocessing you will do next semes

In this assignment we will simulate the kind ofprocessing you will do next semester when you retrieve
records from databases using PHP. From our point of view, we don’t care how the JSON string was
created, we only need to work with it once it arrives in our client-side system.
We haven’t done an exact example of this together, but it has a lot in common with printing variables
from an array in a loop that we did in first semester. What does “

Hello

” mean? Nothing in a
Python program, and not much to JavaScript either, it’s a string. When it becomes part of the DOM, the
browser turns it into a cell in a table. This is the idea we’ve discussed a few times: syntax versus
semantics – the structure versus the meaning.
You are going to be doing exactly that: turning a string into HTML. Except where noted you may create
empty HTML elements and change the innerHTML to achieve your goals but top marks are reserved for
using CreateElement and manipulating the DOM directly. You may still need to modify attributes on
those elements, those details are up to your ingenuity.
Create a page with 3 buttons labelled “First”, “Second”, “Third”, and an input element on it. You can pick
the type of input element you feel best solves the problem.
When any button is pressed you will be sending an AJAX request to
https://csunix.mohawkcollege.ca/~adams/10259/a6_responder.php below you will find the details of
what each request should do. To work correctly with CSUNIX the request must originate on CSUNIX. If
you try to test your work from your local computer you will see a CORS error, a cross site scripting error,
will happen. To develop your solution, I suggest putting the URLs for GET requests into your brower’s
URL bar and putting the returned strings into a variable. This way you can test your code without
uploading it. For the POST request you can use a similar technique or simply test immediately on
CSUNIX.
When the first button is pressed send the AJAX request with no parameters. You should expect the
response to be text. Create a h1 element with this text and your student number. Make the text
centered in a container that fits across the entire width of the page.
When the second button is pressed send an AJAX request along with the value of the input element as a
GET parameter named “choice”. The valid values allowed by the server script are “mario” or “starwars”.
For example:
https://csunix.mohawkcollege.ca/~adams/10259/a6_re…?choice=mario You
should expect the response to a JSON string. The string will encode an array of objects. You will receive
at least 1 and at most 3 elements in the array. For each element in the JSON array create a div to hold
the content. Each attribute of the object will be a string, to keep things simple: a name, a url, and a
series. At the top of the div put the series string in an h2 tag inside the div. Below that show the image
that is linked in the url. Finally, below that put the name. The divs should fill 100% of the width of the
screen: if there are 2 elements then the divs will be 50% each, if there’s 3, 33% each. Be warned you
may have to provide height and width parameters to force the images to resize. Do not leave a blank
div, fill the entire area. It should resemble (but does not have to be the same as) these examples:When thethird buttonis pressed send an AJAX request with the value of the input element as a POST
parameter. The valid values allowed by the server script are “mario” or “star wars”. You should expect
the response to be a JSON string. The string will encode an array of objects. You will receive at least 1
and at most 15 elements. Put the elements returned in a table below the pictures, each object
containing the values for 1 row. The table tag may be hard coded in your html, but the table rows and
cells may not be hard coded and must be dynamically generated by your JavaScript code.
Below the table there should be a copyright notice that matches the content.
Place an appropriate copyright notice below the images depending on whether the input was for Star
Wars or for Mario.The copyright notice for “mario” content is:
Game trademarks and copyrights are properties of their respective owners. Nintendo properties are trademarks of Nintendo.
© 2019 Nintendo.
The copyright notice for “starwars” is:
Star Wars © & TM 2022 Lucasfilm Ltd. All rights reserved. Visual material © 2022 Electronic Arts Inc.
NOTES: that there is no guarantee the user will not change the input between button presses, so how
will you make the two pieces of content match one another? To simplify the overall situation, you may
choose to disable the input tag once one of the 2nd or 3rd buttons is pressed to avoid tracking state and
managing a more complicated situation.
The use of Bootstrap to make things look nicer is recommended, indeed, you might find it simplifies the
layout dramatically.
Responsive design is not required for this assignment but is always welcome.
NOTE: This is a college-level project DO NOT use any AI tools to write the code. It should be hand-written. DO NOT use high-level programming techniques. Please read and follow all the instructions properly and carefully.

PSY-535 – Assignment 1 Identify an article from a peer reviewed journal that ha

PSY-535 – Assignment 1
Identify an article from a peer reviewed journal that ha

PSY-535 – Assignment 1
Identify an article from a peer reviewed journal that has been published within the past five
years. You need to have access to the full text of this article. The article should focus on any
area of psychological research and include in the content of the article information about the
author’s research hypotheses and theories on which they are based. The first paragraph should
be a very concise summary of the article, and the remainder of the paper should include your
evaluation of how well the research hypotheses are presented and justified, as well as how well
the article describes the background of the theories they used (i.e., for a reader who might be
unfamiliar with the specific theory, is the theory understandable?).
Instructions:
Your assignment must be formatted using APA Style (7th ed)–student research paper template.
Your paper should be no more than 2 pages (not including the title page or references page),
and include at least three peer-reviewed academic references. You are also required to submit
your assignment with the SafeAssign option checked (please review your SafeAssign plagiarism
report prior to submission).

instructions:TITLE Display the output on the screen and work with variables TIME

instructions:TITLE
Display the output on the screen and work with variables
TIME

instructions:TITLE
Display the output on the screen and work with variables
TIME TO COMPLETE
One week (16 weeks classes) – 1 period about 3 days (short term classes)
HOW TO DO EACH PART
Do the lab with the following:
STEP1: CREATE THE PSEUDO-CODE AND LEARN JAVA SYNTAX
1. Read the lab requirement then figuring out: -What does the requirement ask for? -Then, figure out and list step by step in English what do you need to do to come up the final solution (in a word document)that must be qualified to the requirement. This document is called as the pseudo-code.
2. Learn the Java syntax to translate each English step in the pseudo-code to Java language (that means write the java code). If you need help on this step, read the topics relating to the action of each step in HOW TOT DO LAB to learn the java syntax. For example, the lab requirement asks you to display something on the screen, then you can read the topic “How to display output on the screen” in the HOW TO DO LAB.
3. When you are ready with java syntax that needs for the lab, you bring up the eclipse or other editor to start writing java program.
STEP2: CREATE THE JAVA PROJECT AND WRITE THE JAVA CODE
*From now and on yourLastName will be changed to your last name
*Your program should change Martinez to your last name
*Change LUIZ MARTINEZ to your full name
*write the file name as the first comment line at the top of program. The java comment line starting with // as the comment line in java
*After running your program successfully, take the picture of the output window and paste the picture at the bottom of the document having pseudo-code to turn in
1. Start editor eclipse, create the project à write the project name Project name of the Part 1: SP2024_LAB1PART1_yourLastName Project name of the Part 2: SP2024_LAB1PART2_yourLastName
2. Add the driver class that includes the function main(). Class name will be the file name.
Part1: add the driver class with the name as SP2024_DisplayOnScreen_yourLastName
Part2: add the driver class with the name asSP2024_ProgramWithVariables_yourLastName
⇨ An empty window is coming up that is ready for you to write java code
3. In the empty class, type the following template of a java program in:
For example with the Part1 (yourLastName should be changed to your last name
//File name: SP2024_DisplayOnScreen_yourLastName.java
public class SP2024_DisplayOnScreen_yourLastName {
public static void main(String[ ] args)
{
//add the code here below this line
…..
}
}
STEP3: COMPILE THE CODE AND FIX THE ERRORS STEP4: RUN THE PROGRAM
*With eclipse, the project will be automatically compiled, creates the object file .class then run to provide the output on the Console window if the code with no syntax errors.
LAB1 PART1 REQUIREMENT
Using java to provide the application to display the following output in 12 lines:
LAB1 PART2 REQUIREMENT
Provide the pseudo-code and a java program to allow users to enter their own required information from the keyboard. (That means the program should read input from the keyboard)
-The users should be asked to enter from the keyboard to provide two words, and 3 decimal numbers to the application.
-After reading the above input, the application will display the output on the screen with the following information and in the following format:
For example, If users provide input from the keyboard:
-2 words: Test and Hello
-3 numbers: 87.6, 76.5, 65.4
Then the output will be in 11 lines as below:
HOW TO TURN IN THE LAB
ATTENTION: Compress each project folder into a file .zip or a file .rar. that includes source files and class files.
-If you do not have the source file and class file, your lab gets 0 points
-If you do not provide file .class of the part, you only have half of the max score of the part
You should turn in the following files:
1.Lab1_pseudoCode_yourLastName.docx(includingPseudo-code and the output pictures of both parts)
2.SP2024_LAB1PART1_yourLastName.zip (including file SP2024_displayOnScreen_yourLastName.java and file SP2024_displayOnScreen_yourLastName.class)
3.SP2024_LAB1PART2_yourLastName.zip (including file SP2024_ProgramWithVariables_yourLastName.java
and file SP2024_ProgramWithVariables_yourLastName.class)
HOW TO GRADE THE LAB
ITEMS TO GRADE
SCORE
COMPLETE LAB ON TIME
3
Part1: Name of project and source file correct – turn in requested files
1
Part1: Pseudo-code correct with the pictures of output windows
2
Part1: Create the project – no errors – qualified to the requirement
3
Part1: Comment about file name
1
Part1: Display output 12 lines using the variables
2
Part1: Change Martinez to your last name and LUIZ MARTINEZ to your full name
1
Part2: Name of project and source file correct – turn in requested files
1
Part2: Pseudo-code correct with the pictures of output windows
2
Part2: Create the project – no errors – qualified to the requirement
3
Part2: Comment about file name and each main action
2
Part2: declare variables correct
2
Part2: Read input from the keyboard
1
Part2: Calculate correct average
1
Part2 Display 11 lines as requested; separate from input
3
Part2 Display output using variables
1
Part2: Change Martinez to your last name and LUIZ MARTINEZ to your full name
1
Total
30
Instructor: Liem Le – COSC1437 7

Answer the following questions inside the conceptual.md file. Part 2: Timeword.j

Answer the following questions inside the conceptual.md file.
Part 2: Timeword.j

Answer the following questions inside the conceptual.md file.
Part 2: Timeword.js
Solve the following problem in JavaScript:
Turn a string of 24h time into words.
You can trust that you’ll be given a valid string (it will always have a two-digit hour 00-23, and a two-digit minute 00-59). Hours 0-11 are am, and hours 12-23 are pm.Examples of the output we’d like:
InputExpected Output
00:00
midnight
00:12
twelve twelve am
01:00
one o’clock am
06:01
six oh one am
06:10
six ten am
06:18
six eighteen am
06:30
six thirty am
10:34
ten thirty four am
12:00
noon
12:09
twelve oh nine pm
23:23
eleven twenty three Write tests for these cases and make sure your code passes these.
Also, do this without the aid of any external packages. The goal here is to have you think about how you’d solve the problem, not have you show us how good you are at finding third-party libraries.
Part 3: Buggy App
You’ve just joined a team that is building a web app for a financial system, bankly.
You have a generally-nicely-written application and it even has tests, and all tests pass!
However, there are several bugs in the application — they’re just not things that are being tested for (so, in a sense, there are two bugs for each: the broken code, and the fact that there’s no test that caught it).
Some bugs relate to methods returning slightly-wrong information, or being too flexible in what they accept, or failing to check reasonable security requirements.
Get the App RunningFirst step is to get everything running. We’ve made the commands easy for you:
cd bankly
npm install
npm run seed # sets up the regular and test databases
npm test # runs jest
npm start # runs server w/ ‘node’; feel free to change to nodemon
Strategiesread the docstrings for the routes carefully. Treat these as your “source of truth” for what the function is supposed to do.
look at what tests are provided, and think about whether these tests are strict enough to sufficiently test what the function needs to do.
think about what tests are missing that could catch these bugs.
GoalsWe’ve put in six bugs (it’s possible that there are other, unintentional bugs, too).
Be mindful of the definition of a bug. If this application is missing a feature or something that would be “nice to have” – that does not mean it’s a bug. Please only include things that certainly lead to errors or security issues in our application.
You don’t need to find all six — but do the best you can!
Warning: one of the bugs is quite tricky and subtle, and would require some careful study to find.
Want a clue on the tricky, hard-to-notice, elusive bug #6? C
You should turn in:
a short description of the bug
A test that catches that case (put in a comment, eg // TESTS BUG #1, so we can find it)
A fix for the code (put in a comment, eg // FIXES BUG #1, so we can find it)
Full Example Bug FixIf you were given an add function:
add.js
/** Given two numbers, add positive versions of them together. */
function addAbsoluteVals(x, y) {
return Math.abs(x) + y;
}
And it had some tests already:
__tests__/add.test.js
describe(‘addAbsoluteVals’, function () {
it(‘should add two positive numbers’, function () {
expect(addAbsoluteVals(2, 3)).toBe(5);
});
});
You could write a test that fails, proving a bug exists:
__tests__/add.test.js
Then document the bug in your markdown file:
bugs.md
Then fix the code and document the fix in a comment:
add.js
/** Given two numbers, add positive versions of them together. */
function addAbsoluteVals(x, y) {
// FIXES BUG #1
return Math.abs(x) + Math.abs(y);
}

i have attached an example of a basic client/server app connection working for y

i have attached an example of a basic client/server app connection working for y

i have attached an example of a basic client/server app connection working for you to understand what you have to do. To run it, you must open the JavaClient app and JavaServer app in 2 different Eclipse IDE workspaces. You run the server first, then the client
The example only shows the connection between one client and the server but remember that the chat application you are working on has to accept connections from multiple clients to a server. Follow the proper assignment instructions and go through the example i sent you to see how you have to make the multi-client/server connection and do not forget the the JavaClient app has to be a GUI designed group chat and the JavaServer which is a separate file that accepts the connection from the clients when they enter the username and IP address .