ITM448_WEEK4
.docx
keyboard_arrow_up
School
California State University, Long Beach *
*We aren’t endorsed by this school
Course
4278
Subject
Computer Science
Date
Jan 9, 2024
Type
docx
Pages
6
Uploaded by dattnguyenn8196
CHRISTOPHER CONSUL
09/15/2022
ITM 448 18:00-21:00
ITM448 Homework – Week 4
Edit your submission in this word document, attaching the screenshots of the codes
used for each question. Include narrative descriptions, outputs screenshot, or short
answers when requested.
Task 1
Please generate a vector of the following values:
12,32,33,44
and assign this vector to a variable x.
Then output the first element and the last element from this vector
Task 2
Following the previous question, please square each number of the vector, and name the new vector “y”.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Question 9
Program a CSS ruleset that will set the root font size for the HTML document to match the user's browser
preference.
Feedback
Question 2
Program a CSS media query that is triggered if the screen is at least 900px wide, but use em as the size unit in
the query.
Within the media query, write a rule for an element with a id equal to header. That rule should set the font
size to three times the current size.
Note: You should assume the parent element's font-size is equivalent to 16px.
@media screen and (min-width: 56.25em) {
.header {
font-size:300%;
}
}
arrow_forward
Assignment
For assignments 1 and 2, your Big-O notation and justification will be written in the HTML section of JSFiddle. You will be using the Javascript array
Programming Assignment Part 1 –
Using your JSFiddle account and JavaScript, you will create a program that will instantiate an integer array of a specified size. This means you must create a text box interface and a button “Create Array”. Put a default value of 100 in the Text Box. When the user clicks “Create Array” create an array and fill each array element with a random integer between 1 and 100. You will need to research the random function to do this (the JavaScript function is Math.random()). This array should be a global variable.
You will next need an interface (same JSFiddle) with a second and third Text Box and button. The button will say “Insert into Array”. It will trigger a function that will read a number from the second Text Box and insert it into the array at the index of the third Text Box. This will be done…
arrow_forward
Using functions right this code with javascript
arrow_forward
R Script Homework 4
Using RStudio, create a new R script and save it as: "CMSC4103 Your Name HW4 R. For student John
Doe, the file would be named "CMSC4103_JohnDoe HWAR". Then do the following:
1) Create or read an existing data frame containing
a) A character column that acts as a label and has unique values in each row
b) 2 or more numeric columns on the same scale (eg prices, counts, test scores, etc.)
C
2) Find the mean, standard deviation, and interquartile range of both original numeric variables,
allowing for missing values.
3) Create a new variable that is a function of the 2 numeric variables.
4) Create a rank variable for at least 1 numeric variable.
5) Use ggplot2 to:
a) Create a "publication ready" plot of 2 or more variables to help explain the data.
b) Create a "publication ready" plot that includes at least one rank variable to help explain the
data
$
C
4
E R
F
Search or type URL
5
:
T
6
Y
G H
49
&
7
★
U
8
1
9
J K
0
arrow_forward
Write a for-loop that will write to the HTML document the value of each element in the array called myArray.
Note: You only need to write a for-loop. Code on the outside of the for-loop is not necessary as we will assume that myArray has been declared and initialized with a series of array elements.
arrow_forward
web
arrow_forward
<style>// selecting required elementconst element = document.querySelector(".pagination ul");let totalPages = 10;let page = 2;
//calling function with passing parameters and adding inside element which is ul tagelement.innerHTML = createPagination(totalPages, page);function createPagination(totalPages, page){ let liTag = ''; let active; let beforePage = page - 1; let afterPage = page + 1; if(page > 1){ //show the next button if the page value is greater than 1 liTag += `<li class="btn prev" onclick="createPagination(totalPages, ${page - 1})"><span><i class="fas fa-angle-left"></i> Prev</span></li>`; }
// how many pages or li show before the current li if (page == totalPages) { beforePage = beforePage - 2; } else if (page == totalPages - 1) { beforePage = beforePage - 1; } // how many pages or li show after the current li if (page == 1) { afterPage = afterPage + 2; } else if (page == 2) { afterPage = afterPage +…
arrow_forward
Assign
1. Assign the value 9.81 to the variable gravity_si, and the value 32.17 to the variable gravity_eng.
2. Create a row vector containing the elements 0.5772, 1.618, 2.718 and 3.1416. Assign it to the variable math_consts.
3. Create a row vector containing the values from 50 to a value less than or equal to 1 with a decrement of 2. Assign it to the variable r_vec1.
4. Create a row vector containing linearly spaced values from 0 to π with exactly 37 elements. Assign it to the variable r_vec2.
5. Create a column vector containing the elements 6.022×1023, 1.381×10–23 and 6.626×10–34. Assign it to the variable science_consts.
6. Create a matrix containing the elements 10, 4, 7, 9 and 11 on the first column, the elements 12, 8, 2, 3 and 4 on the second column, and the elements 7, 0, 12, 6 and 5 on the third column. Assign it to the variable mat1.
7. Create a 6×8 matrix with all elements equal to zero. Assign it to the variable mat2.
8. Assign the word discrete as a character type to…
arrow_forward
True or False
.Each of our header and trailer sentinels contain an actual element.
arrow_forward
3.
The jQuery Example
This is first paragraph.
This is second paragraph.
This is third paragraph.
pearson.com
i) Answer following questions by utilizing JQuery methods inside a script tag using the HTML file above:
a) Fetch title attribute of tag and enter the same value inside the div tag
with id = divid.
b) Select all the elements with the tag name p and turn the background of those elements to yellow. 2
c) Add a hyperlink using the element as last child which leads to google.com inside the div tag
with class named linkOut.
arrow_forward
Hi Please write this program using Javascript. Please attach or share a screenshot of the javascript
2. Create an empty <div> element with an id of your name. This element should be used to display your output from JavaScript.
3. Create a JavaScript file with your studentid.js and link it to your HTML file created above. Perform the following exercise in your JavaScript file:
a. Declare an empty array that will be used to store integer numbers.
b. Write a loop that iterates 30 times. In each iteration of the loop, generate a new random number between 0-50 and insert the value in your array (created above).
c. After exiting your loop, display the content of your array in an h2 element inside the div element created in your HTML document, where array elements are separated by the double quote ”.
d. Loop through your array and count the instances of numbers 7 and 9 found in your array. As you are looping through the array, also replace each instance of number 3 with your first…
arrow_forward
Use all arrays to display the selected employee data in HTML form inside table with default
values as follows:
Note the following when sending data to WB:
a) The form method is post and the action script is
savep.php.
b) Display the image of the selected employee, title and
its ID in the top of the page
c) Send the index value of the employee data from the
array as a hidden field
d) The invisible values for each of the department, job,
and gender should be its array index.
e) The value of the day and month should be
formatted as 2 digits with leading zero to the left.
For the year, display last 30 years
Editing Employee Data for:
employf.php
Yahay Abdullah Al-Aamry
ID:C301
First Name Yahay
Last Name A-Aamry
Second Name Abdulah
Name
Basic Salary 890.32
Gender
O Male OFemale
Department
Information Technology v
Job Title
O Programmer O Manager O Salesman O Accountant
Date of Birh: Day: 26 v Month October (10)
v Year 1909 v
Save Employee's Data
arrow_forward
please need this ASAP
arrow_forward
Week 4 Lab assessment task
Use the function julia, that you have defined, to produce an image of a Julia set.
Please try to find a "nice" seed constant that produces an interesting Julia set that is different from the provided
example. At your choice, you may also customise the colour map or other aspects of the image.
Use the title command, and optionally the subtitle command, to add a title in the same format as the image
shown below.
Sample code:
julia (0.4,0.4,1500,50) ;
2 hold on
3 title (" Julia set c = 0.4 + 0.41")
4 subtitle ("Oliver Heaviside ID 123456789")
s hold off
arrow_forward
Question 6
Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this line
arrow_forward
create a web page that prompts the user to enter the names of the members and stores the names in an array of 6 elements. then sort the array and display the member's names of the students before and after the sorting?
arrow_forward
Using the existing code:
Create a shoppingcart.js file and include it in the products page. In the shoppingcart.js file, create an empty array to store the items added to the cart. Create a products array and create a product object for each of your products and store it in the products array when the script loads.
The shoppingcart.js should:
Program the add button to take the product id from products.html, finds the product object in the products array and add it to the items purchased array.
Program the remove button to take the product id from products.html and remove the corresponding object from the items purchased array.
Return html for displaying the items in the cart.
Existing code:
products.html
<!DOCTYPE html><html><head><title>Products</title></head><body><div><div class="product"><img src="img/clorox.jpg"><p class="price">Price: $10</p><p class="name">Name: Clorox</p><p…
arrow_forward
HTML & PHP use columns to format
Create an HTML page pizza.html that displays the form above. The user will select a size, any number of toppings, and a crust. The Crust combo box will have the choices: thin, original, and deep dish. When the Submit button is clicked, the data is submitted to pizza.php. The PHP file will display the name and total which is calculated using:
Size: large: $9.95 x-large: $12.95
Toppings: $1.25 per topping
Crust: no charge except for deep dish which is $2.00 additional
Modify your pizza.php page to save the name and total data to the file pizza.txt
Final product should resemble this image below
arrow_forward
Microsoft Excel Formula assignment: The objective of this assignment is to create 20 [5x5] tables and each 5 by 5 table will have mix of numbers from 1 to 100. (NOTE: There can't be ANY duplicate numbers in the 25 cells). The numbers placed in the 5x5 table cannot match with any other table AND again, each table cannot repeat the same number.
I need to create this without having to manually type numbers and create the 5 by 5 tables.What is the fastest way to create these tables using formulas? This assignment demonstates the examples for formulas on excel. Here is two examples for 2 tables.TABLE 1:1 2 3 4 56 7 8 9 1011 12 13 14 1516 17 18 19 2021 22 23 24 25TABLE 2:59 2 3 4 133 72 8 9 6611 22 13 88 1516 17 18 19 529 40 99 30 21Here is an example that will NOT work.1 2 66 4 216 7 8 7 910 11 12 39 4182 88 88 88 29100 33 35 32 51
arrow_forward
Given the following 1D array of 7 strings:
"SHIP" "CUP"
The first element located at index 0 is "LION". The last element located at index 6 is
"CUP". (Note that the indexing starts from 0)
"LION"
"ICE" "YOLK"
"ROCK" "POT"
Perform Selection Sort to rearrange the elements in alphabetical order. Simulate the
algorithm and fill in the required array element values in the following items. You have
the option not to to type the double quotes in your answers.
arrow_forward
the "list.txt" contains information about materials stored in the warehouse. Every record (line) in the file contains code, name and description seperated by "#"
write a php script that will open the file, read the content of the file and manupulate using associative array with code as a key.
the array should be sorted by the code and displayed to the user.
arrow_forward
Please have each element in bold font and the responses to each element in italics font.
arrow_forward
Create a MyStruct variable and set the second field to an array of zeros.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Related Questions
- Question 9 Program a CSS ruleset that will set the root font size for the HTML document to match the user's browser preference. Feedback Question 2 Program a CSS media query that is triggered if the screen is at least 900px wide, but use em as the size unit in the query. Within the media query, write a rule for an element with a id equal to header. That rule should set the font size to three times the current size. Note: You should assume the parent element's font-size is equivalent to 16px. @media screen and (min-width: 56.25em) { .header { font-size:300%; } }arrow_forwardAssignment For assignments 1 and 2, your Big-O notation and justification will be written in the HTML section of JSFiddle. You will be using the Javascript array Programming Assignment Part 1 – Using your JSFiddle account and JavaScript, you will create a program that will instantiate an integer array of a specified size. This means you must create a text box interface and a button “Create Array”. Put a default value of 100 in the Text Box. When the user clicks “Create Array” create an array and fill each array element with a random integer between 1 and 100. You will need to research the random function to do this (the JavaScript function is Math.random()). This array should be a global variable. You will next need an interface (same JSFiddle) with a second and third Text Box and button. The button will say “Insert into Array”. It will trigger a function that will read a number from the second Text Box and insert it into the array at the index of the third Text Box. This will be done…arrow_forwardUsing functions right this code with javascriptarrow_forward
- R Script Homework 4 Using RStudio, create a new R script and save it as: "CMSC4103 Your Name HW4 R. For student John Doe, the file would be named "CMSC4103_JohnDoe HWAR". Then do the following: 1) Create or read an existing data frame containing a) A character column that acts as a label and has unique values in each row b) 2 or more numeric columns on the same scale (eg prices, counts, test scores, etc.) C 2) Find the mean, standard deviation, and interquartile range of both original numeric variables, allowing for missing values. 3) Create a new variable that is a function of the 2 numeric variables. 4) Create a rank variable for at least 1 numeric variable. 5) Use ggplot2 to: a) Create a "publication ready" plot of 2 or more variables to help explain the data. b) Create a "publication ready" plot that includes at least one rank variable to help explain the data $ C 4 E R F Search or type URL 5 : T 6 Y G H 49 & 7 ★ U 8 1 9 J K 0arrow_forwardWrite a for-loop that will write to the HTML document the value of each element in the array called myArray. Note: You only need to write a for-loop. Code on the outside of the for-loop is not necessary as we will assume that myArray has been declared and initialized with a series of array elements.arrow_forwardwebarrow_forward
- <style>// selecting required elementconst element = document.querySelector(".pagination ul");let totalPages = 10;let page = 2; //calling function with passing parameters and adding inside element which is ul tagelement.innerHTML = createPagination(totalPages, page);function createPagination(totalPages, page){ let liTag = ''; let active; let beforePage = page - 1; let afterPage = page + 1; if(page > 1){ //show the next button if the page value is greater than 1 liTag += `<li class="btn prev" onclick="createPagination(totalPages, ${page - 1})"><span><i class="fas fa-angle-left"></i> Prev</span></li>`; } // how many pages or li show before the current li if (page == totalPages) { beforePage = beforePage - 2; } else if (page == totalPages - 1) { beforePage = beforePage - 1; } // how many pages or li show after the current li if (page == 1) { afterPage = afterPage + 2; } else if (page == 2) { afterPage = afterPage +…arrow_forwardAssign 1. Assign the value 9.81 to the variable gravity_si, and the value 32.17 to the variable gravity_eng. 2. Create a row vector containing the elements 0.5772, 1.618, 2.718 and 3.1416. Assign it to the variable math_consts. 3. Create a row vector containing the values from 50 to a value less than or equal to 1 with a decrement of 2. Assign it to the variable r_vec1. 4. Create a row vector containing linearly spaced values from 0 to π with exactly 37 elements. Assign it to the variable r_vec2. 5. Create a column vector containing the elements 6.022×1023, 1.381×10–23 and 6.626×10–34. Assign it to the variable science_consts. 6. Create a matrix containing the elements 10, 4, 7, 9 and 11 on the first column, the elements 12, 8, 2, 3 and 4 on the second column, and the elements 7, 0, 12, 6 and 5 on the third column. Assign it to the variable mat1. 7. Create a 6×8 matrix with all elements equal to zero. Assign it to the variable mat2. 8. Assign the word discrete as a character type to…arrow_forwardTrue or False .Each of our header and trailer sentinels contain an actual element.arrow_forward
- 3. The jQuery Example This is first paragraph. This is second paragraph. This is third paragraph. pearson.com i) Answer following questions by utilizing JQuery methods inside a script tag using the HTML file above: a) Fetch title attribute of tag and enter the same value inside the div tag with id = divid. b) Select all the elements with the tag name p and turn the background of those elements to yellow. 2 c) Add a hyperlink using the element as last child which leads to google.com inside the div tag with class named linkOut.arrow_forwardHi Please write this program using Javascript. Please attach or share a screenshot of the javascript 2. Create an empty <div> element with an id of your name. This element should be used to display your output from JavaScript. 3. Create a JavaScript file with your studentid.js and link it to your HTML file created above. Perform the following exercise in your JavaScript file: a. Declare an empty array that will be used to store integer numbers. b. Write a loop that iterates 30 times. In each iteration of the loop, generate a new random number between 0-50 and insert the value in your array (created above). c. After exiting your loop, display the content of your array in an h2 element inside the div element created in your HTML document, where array elements are separated by the double quote ”. d. Loop through your array and count the instances of numbers 7 and 9 found in your array. As you are looping through the array, also replace each instance of number 3 with your first…arrow_forwardUse all arrays to display the selected employee data in HTML form inside table with default values as follows: Note the following when sending data to WB: a) The form method is post and the action script is savep.php. b) Display the image of the selected employee, title and its ID in the top of the page c) Send the index value of the employee data from the array as a hidden field d) The invisible values for each of the department, job, and gender should be its array index. e) The value of the day and month should be formatted as 2 digits with leading zero to the left. For the year, display last 30 years Editing Employee Data for: employf.php Yahay Abdullah Al-Aamry ID:C301 First Name Yahay Last Name A-Aamry Second Name Abdulah Name Basic Salary 890.32 Gender O Male OFemale Department Information Technology v Job Title O Programmer O Manager O Salesman O Accountant Date of Birh: Day: 26 v Month October (10) v Year 1909 v Save Employee's Dataarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L