Rewrite the query methods used in the JS statements in lines 17, 18, 19, and 20 by using querySelector() or querySelectorAll() methods. Note that your code has to return the same outputs on the console (in a browser's developer tab, Ctrl + Shift + J) before you make the changes.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Access HTML elements </title>
</head>
<body>
<section id="main">
<h1>The 2011-2012 Speaker
Lineup </h1>
<p class="blue">October 19,
2011: Jeffrey Toobin </p>
<p class="blue">November 16,
2011: Andrew Ross Sorkin </p>
</section>
<footer>
<p class="right">Copyright
2012 </p>
</footer>
<script>
var sec =
document.getElementById('main');//return the <section>
element which has id="main"
var list1 =
document.getElementsByTagName('p');//return the HTMLCollection
object containing 3 <p> elements that belongs to
class="blue"
var list2 =
sec.getElementsByTagName('p');//return the HTMLCollection object
containing 2 <p> elements
var list3 =
sec.getElementsByClassName('blue'); ////return the HTMLCollection
object containing 2 <p> elements in the <section>
element
console.log(sec);
console.log(list1);
console.log(list2);
console.log(list3);
</script>
</body>
In: Computer Science
An Euler Circuit is a circuit that crosses every edge exactly once without repeating. A graph has an Euler Circuit if and only if (a) the graph is connected and (b) the degree of every vertex is even. Find a lower bound for the time complexity of all algorithms that determine if a graph has an Euler Circuit. In which of the three general categories discussed in Section 9.3 does this problem belong? Justify your answer.
In: Computer Science
Using C #
Problem: "Tom is from the U.S. Census Bureau and greets Mary at her
door. They have the following conversation: Tom: I need to know how
old your three kids are. Mary: The product of their ages is 36.
Tom: I still don't know their ages. Mary: The sum of their ages is
the same as my house number. Tom: I still don't know their ages.
Mary: The younger two are twins. Tom: Now I know their ages!
Thanks! How old are Mary's kids and what is Mary's house
number?"
The solution is 2,2,9, therefore mary's house # is 13
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is the code i have thus far:
Console.WriteLine("What is the age of the first child");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("What is the age of the second child");
num2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("What is the age of the third child");
num3 = Convert.ToInt32(Console.ReadLine());
How do I make it loop until they get the correct answer. (2,2,9) or (2,9,2) or (9,2,2)
If they get the answer wrong, I want the user keep trying again until they enter "quit"
In: Computer Science
(35 pt.) Prove that the following languages are not regular using the pumping lemma.
(15pt.)?={?????? |?,?≥?}
(20 pt.) ? = {? ∈ {?, #}∗ | ? = ??#??# ... #?? ??? ? ≥ ?, ?? ∈
?∗ ??? ????? ?, ??? ?? ≠?? ???????? ?≠?}
Hint: choose a string ? ∈ ? that contains ? #’s.
In: Computer Science
need new and unique answers, please. (Use your own words, don't copy and paste), Please Use your keyboard (Don't use handwriting) Thank you..
The data warehouse is one of the most important business intelligence tools a business needs to have. It turns the massive amount of data generated from multiple sources into a format that is easy to understand. Discuss the data warehouse concept?
In: Computer Science
Compare two programming languages of your choice based on all these criteria.
1. Readability
2. Writability
3.Reliability
4. Cost
In: Computer Science
in c#:
Create a class named Square that contains fields for area and the length of a side and whose constructor requires a parameter for the length of one side of a Square. The constructor assigns its parameter to the length of the Square’s side field and calls a private method that computes the area field. Also include read-only properties to get a Square’s side and area. Create a class named DemoSquares that instantiates an array of ten Square objects with sides that have values of 1 through 10. Display the values for each Square. Save the class as DemoSquares.cs
PLEASE SHOW THE OUTPUT.
In: Computer Science
Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If you do not have any network environment, you can run on a single machine by instantiating your program multiple times. E.g. you can have program1 and program 2 running on same machine exchanging texts between themselves.
In: Computer Science
need to output this in java
Enter an integer: 5
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5
4 4 4 4 4 4 4
3 3 3 3 3
2 2 2
1
(in the shape of a diamond)
please help me with the correct code, thanks
In: Computer Science
For any gas whose internal energy depends on temperature only,
the relation between pressure p, molar volume v, and absolute
temperature T can be approximated by using the Ideal Gas law: ??=??
where R is the universal gas constant. If p is measured in
atmospheres, v in liters/mole, and T in Kelvin, then R=0.08205
????? ?????? ?.
However, for certain physical conditions (notably high T and/or
high p), gases may behave in a nonideal way. A more general
description of their behavior is given by the following
higher-order approximation, known as the Beattie-Bridgeman
Equation: ?=???+??2+??3+??4,
where ?,?,and ? are temperature dependent quantities given as
follows: ?=?0??−?0−???2 ; ?=−?0???+?0?−?0???2 ; ?=?0????2.
Constants ?0,?0,?,?,and ? have been determined by fitting curves to
experimental data. For methane (CH4), the values of the constants
(in units consistent with the ones above) are: ?0=2.2769;
?0=0.05587; ?=0.01855; ?=−0.01857; and ?−12.81?4.
a. (24 points) Write a program that, when given T in kelvin and p
in atmospheres, uses Muller’s Method to solve the Beattie-Bridgeman
Equation for the molar volume of CH4. You are not required use
complex variables, but you should include a section in your program
that checks to see whether ??+1 is complex, and, if it is, stops
the method. Close initial guesses chosen in part b will allow you
to find the root without venturing into the complex plane. Try to
reduce the number of function evaluations.
Before the iteration begins, your program should print the starting
estimates ?−2,?−1,?0 and their corresponding ?(?) values. At each
iteration, your program should print out the iteration number
(?),??,?(??), and the quantity |??−??−1||??|. Implement a
convergence criterion of the form: |??−??−1||??|≤?,?ℎ???
?=10−5
When your program finishes running, it should either print out the
converged solution and the number of iterations required, or else
it should print out a statement that a solution could not be found
(perhaps because the method found a complex ??+1.
b. (8 points) Run your program for the following data (note that
there are 10 possible combinations): ?=500 and 1500 ?,with
?=1,5,10,50 and 100 atm. In each case, choose your own starting
points (perhaps using the Ideal EoS).
In: Computer Science
Using c++,
1: Create a vector of 20 randomly generated integers, then
2. Create a new vector that will only store the even numbers from the original vector.
3. Display the original vector and the vector of even integers to the console.
In: Computer Science
What did I do wrong? When you click on the small caption of the photo, it is supposed to have a call to AJAX that changes the small description of my fav activities to a bigger description.
For example, when you click "cooking" it should change to what I have in the biginfo file but it does not change.
This is the full code. The "biginfo" files I have are done, don't have anything but the fuller description.
HTML
_________________
<!DOCTYPE html>
<html>
<head>
<title>Slideshow</title>
<meta name="viewport" content="width=device-width,
initial-scale=1">
<meta content="text/html; charset=iso-8859-2"
http-equiv="Content-Type">
<link rel="stylesheet"
href="https://www.w3schools.com/w3css/4/w3.css">
<style>
.mySlides {display:none;}
.onPic{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: black;
font-size: 12px;
}
</style>
</head>
<body>
<h2 class="w3-center">My Favorite Actitivies</h2>
<div class="w3-content w3-section"
style="max-width:500px">
<div class="mySlides">
<img src="cooking.jpg" style="width:100%">
<button class="onPic" type="button"
onclick="loadDoc1()">Cooking</button>
</div>
<div class="mySlides">
<img src="lacrosse.jpg" style="width:100%">
<button class="onPic" type="button"
onclick="loadDoc2()">Lacrosse</button>
</div>
<div class="mySlides">
<img src="jogging.jpg" style="width:100%">
<button class="onPic" type="button"
onclick="loadDoc3()">Jogging</button>
</div>
<div class="mySlides">
<img src="music.jpg" style="width:100%">
<button class="onPic" type="button"
onclick="loadDoc4()">Listening to music</button>
</div>
<div class="mySlides">
<img src="dog.jpg" style="width:100%">
<button class="onPic" type="button"
onclick="loadDoc3()">Playing with my dog</button>
</div>
<div class="mySlides">
<img src="tv.jpg" style="width:100%">
<button class="onPic" type="button"
onclick="loadDoc4()">Watching TV</button>
</div>
</div>
<script>
var myIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 7000); // Change image every 2 seconds
}
function loadDoc1() {
var xhttp1 = new XMLHttpRequest();
xhttp1.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp1.open("GET", "biginfo1.txt", true);
xhttp1.send();
}
function loadDoc2() {
var xhttp2 = new XMLHttpRequest();
xhttp2.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp2.open("GET", "biginfo2.txt", true);
xhttp2.send();
}
function loadDoc3() {
var xhttp3 = new XMLHttpRequest();
xhttp3.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp3.open("GET", "biginfo3.txt", true);
xhttp3.send();
}
function loadDoc4() {
var xhttp3 = new XMLHttpRequest();
xhttp3.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp3.open("GET", "biginfo4.txt", true);
xhttp3.send();
}
function loadDoc5() {
var xhttp3 = new XMLHttpRequest();
xhttp3.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp3.open("GET", "biginfo5.txt", true);
xhttp3.send();
}
function loadDoc6() {
var xhttp3 = new XMLHttpRequest();
xhttp3.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp3.open("GET", "biginfo6.txt", true);
xhttp3.send();
}
</script>
</body>
</html>
BIGINFO1
--------------------
"I like to cook because it is fun"
In: Computer Science
Summary
Figure 3–79 shows an example page containing two applications of floating objects. In the first line of Lincoln’s second inaugural speech a drop capital is created by floating the first letter of the first paragraph next to the surrounding text. The text of the speech is wrapped around the image of Lincoln using an irregular line wrap. This effect is created by cutting the Lincoln image into separate strips which are floated and stacked on top of each other. In this Coding Challenge you will explore how to create both effects.
Figure 3-79
Do the following:
1. Open the files code3-1.html and code3-1_float.css and in the comment section enter your name (First + Last) and the date (MM/DD/YYYY) into the Author: and Date: fields of the file.
2. Go to the code3-1.html file in your editor. Within the head section insert a link element linking the page to the code3-1_float.css style sheet file. Take some time to study the content of the page.
3.lOpen the file code3-1_float.css, and for all img elements create a style rule to set the height of the image to 3.3em. Float all img elements on the right margin, but only when the right margin is first cleared of any floats. (Hint: clear: right).
4. To create a drop cap insert a style rule for the selector p:first-of-type::first-letter and add the following styles:
5. Display the first line of the speech in small caps by adding a style rule for the selector p:first-of-type::first-line that changes the font variant to small-caps and the font size to 1.4em.
6. Open the page in the browser preview and verify the layout of the page resembles that shown in Figure 3-79.
Code 3-1.HTML to be edited:
<!doctype html>
<html lang="en">
<head>
<!--
New Perspectives on HTML5 and CSS3, 8th Edition
Tutorial 3
Coding Challenge 1
Author:
Date:
Filename: code3-1.html
-->
<meta charset="utf-8">
<title>Coding Challenge 3-1</title>
<link href="code3-1.css" rel="stylesheet" />
</head>
<body>
<h1>Lincoln's Second Inaugural</h1>
<p>The Almighty has his own purposes. "Woe unto the world because of offenses! For
<img src="lincoln01.png" alt="" />
<img src="lincoln02.png" alt="" />
<img src="lincoln03.png" alt="" />
<img src="lincoln04.png" alt="" />
<img src="lincoln05.png" alt="" />
<img src="lincoln06.png" alt="" />
<img src="lincoln07.png" alt="" />
<img src="lincoln08.png" alt="" />
<img src="lincoln09.png" alt="" />
<img src="lincoln10.png" alt="" />
it must needs be that offenses come; but woe to that man by whom the offense
cometh." If we shall suppose that American slavery is one of those offenses which,
in the providence of God, must needs come, but which, having continued through his
appointed time, he now wills to remove, and that he gives to both North and South
this terrible war, as the woe due to those by whom the offense came, shall we discern
therein any departure from those divine attributes which the believers in a living
God always ascribe to him?
</p>
<p>Fondly do we hope — fervently do we pray — that this
mighty scourge of war may speedily pass away. Yet, if God wills that it continue
until all the wealth piled by the bondsman's two hundred and fifty years of unrequited
toil shall be sunk, and until every drop of blood drawn by the lash shall be paid by
another drawn with the sword, as was said three thousand years ago, so still it must
be said, "The judgments of the Lord are true and righteous altogether."
</p>
<p>With malice toward none; with charity for all; with firmness in the right, as God
gives us to see the right, let us strive on to finish the work we are in; to bind up
the nation's wounds; to care for him who shall have borne the battle, and for his
widow, and his orphan — to do all which may achieve and cherish a just and lasting peace
among ourselves, and with all nations.
</p>
</body>
</html>
Code 3-1.css to be edited:
@charset "utf-8";
/*
New Perspectives on HTML5 and CSS3, 8th Edition
Tutorial 3
Coding Challenge 1
Author:
Date:
Filename: code3-1.css
*/
body {
width: 900px;
margin: 20px auto;
font-family: Baskerville, "Palatino Linotype", Palatino, "Century Schoolbook L", "Times New Roman", "serif";
font-size: 1.25em;
padding-bottom: 30px;
}
h1 {
font-size: 2.2em;
text-align: center;
}
Code 3-1_float.css to be edited:
@charset "utf-8";
/*
New Perspectives on HTML5 and CSS3, 8th Edition
Tutorial 3
Coding Challenge 1
Author:
Date:
Filename: code3-1_float.css
*/
Images being used:
In: Computer Science
The purpose of this homework is to test your knowledge of GUI. Consider a fictional park where the entry price for 1 adult ticket is $50, and for 1 children ticket is $25. Write a simple GUI application that let user to enter the number of tickets and display the total price. The GUI should contain:
● One text field for the user to enter the number of adult tickets
● One text field for the user to enter the number of children tickets
● One button “Calculate total cost”
● One text field to display the total cost When the user clicks the button then the correct cost is displayed in the total price field. If the input text field is empty then it should be treated as 0 tickets.
In: Computer Science
// Lab Homework 11
// Logical Operator AND and OR
// Demonstrate how to use a logical operator
// with a Boolean expression.
#include <iostream>
#include <cctype> // for tolower()
using namespace std;
int main()
{
int numberOfCreditHours; // Number of credit hours
student has completed
float gpa; // The student's cumulative grade point
average
// Ask the user two questions:
cout << "Answer the following questions:"
<< endl << endl;
cout << "How many credit hours have you
completed (0-200): ";
cin >> numberOfCreditHours;
cout << "What is your cumulative GPA
(0.00-4.00)? ";
cin >> gpa;
cout << endl;
// TODO: Students can petition for graduation
if:
// - they have completed 48+ credit hours
// - they have a GPA of 2.0 or greater
//
// Use Logical operators in complex logical
expressions to decide which of the following
// four messages to print:
//
// 1) You may petition for graduation.
// 2) You must raise your GPA before you can
graduate.
// 3) You must complete more credit hours before you
can graduate.
// 4) You must raise your GPA and complete more
credits before graduating.
//
// Use just ONE of the logical operators below in the
expression
// to choose the approprate message. You MAY use the
chosen operator
// more than
once.
//
// Logical AND: &&
// Logical OR: ||
//
// Note: Do NOT worry about situations where the user
doesn't enter Y, y, N, or n
// Use the if structure provided below.
if // (<write a compound logic expression here
for graduating>)
//graduation message
else if // (<write a compound logic expression
here for too low gpa>)
//raise gpa message
else if // (<write a compound logic expression
here for too few credits>)
//complete more credits message
else // else is good enough, no logic expression
needed - it's the only other possibility
// raise gpa and earn more credits
message
cout << endl << endl;
return 0;
}
/* Sample interaction and output:
Test #1
==========================================
Answer the following questions:
How many credit hours have you completed (0-200): 60
What is your cumulative GPA (0.00-4.00)? 3.75
You may petition for graduation.
Press any key to continue . . .
Test #2
==========================================
Answer the following questions:
How many credit hours have you completed (0-200): 60
What is your cumulative GPA (0.00-4.00)? 1.99
You must raise your GPA before you can graduate.
Press any key to continue . . .
Test #3
==========================================
Answer the following questions:
How many credit hours have you completed (0-200): 47
What is your cumulative GPA (0.00-4.00)? 3.25
You must complete more credit hours before you can graduate.
Press any key to continue . . .
Test #4
==========================================
Answer the following questions:
How many credit hours have you completed (0-200): 45
What is your cumulative GPA (0.00-4.00)? 1.75
You must raise your GPA and complete more credits before graduating.
Press any key to continue . . .
*/
In: Computer Science