Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Assignment 1 – Declaring Variables and Data Types / Declaring and Creating Arrays Part 1 – Declaring Variables and Data Types Task 1: Type In Example Code and Run It – 2 points Task 2: Make...

1 answer below »
Assignment 1 – Declaring Variables and Data Types / Declaring and Creating A
ays
Part 1 – Declaring Variables and Data Types
Task 1: Type In Example Code and Run It – 2 points
Task 2: Make modifications to the sample code – 4 point
Task 3: Write your Own Code – 4 points
Task 1: Type in Example Code and Run It
Type the following into your text editor:
Example output:
· Save the file as T1.html.
Task 2: Make modifications to the sample code
Modify the following code to input age, phone and e-mail and display as an alert message (only one alert message) the name, age, phone and e-mail provided by the user. Save the program as T2.html.
!DOCTYPE html
html xmlns=”http:
www.w3.org/1999/xhtml”
ody
script type=”text/javascript”
var greetingString = “Hello”;
var myName = prompt(“Please enter your name”, “”);
var concatString; document.write(greetingString + “ “ + myName + “
”);
concatString = greetingString + “ “ + myName; document.write(concatString);
script
ody
html
Output example:
Hello Ma
y,
WOW, you are 134 years old!
I will contact you by phone XXXXXXXXXXor email: XXXXXXXXXX
Thank you!
Task3: Write your Own Code
Write a program that converts miles to kilometers. There are 1.609 kilometers in a mile. The program should:
· Use prompt function to accept what the user types in.
· Read the user input in a variable $miles2convert, which is the distance to be converted (e.g. the user could type in 20 (miles))
· Convert the distance to kilometers using a mathematical operation (Note: Please note that there is no complicated math associated with task. All what you need to do is just read how many miles the user enters and multiply this number by 1.609).
· Display on the webpage the result of the transformation as decimal.
· Save the program as T3.html
Output example:
20 miles = 32.18 Km
Part 2 – Declaring and Creating A
ays
Task 1: Write your Own Code – 4 points
Task 2: Write your Own Code – 6 points
Task 1: Write your Own Code
The formula for calculating Body Mass Index (BMI) is
Weight * 703 / (height*height).
For example, if you weigh 200 pounds and are 72 inches tall, then you can calculate your body mass index with this expression: (200 * 703) / (72 * 72).
Create a script that declares and assigns two integer variables: one for your weight in pounds and another for your height in inches. Declare another variable and assign to it the results of the body mass calculations. Use document.write() statements to print the value of the weight, height and BMI variables. Include text in the document.write() statements that describes each measure, such as “Your weight is 200 pounds”.
Save the file as T4.html
Task2: Write your Own Code Consider the following a
ay (copy and paste the following a
ay in your text editor)
varmyA
ay = [1,5,1,1,5,2,4,5,2,3,2,4,2,4,2,3,2,3,2,4,2,3,2,4,2,5,1,4,2,4,2,3,2,4,1,1,5,1,1,5,2,4,5,2,3,2,4,2,4,2,3,2,3,2,4,2,3,2,4,2,5,1,4,2,4,2,3,2,4,1,1,5,1,1,5,2,4,5,2,3,2,4,2,4,2,3,2,3,2,4,2,3,2,4,2,5,1,4,2,4,2,3,2,4,1];
· Write a program to display the following:
· Use only the length property, toString() , sort() and indexOf() methods to get information about the a
ay.
· Please note: no loops, conditional statements allowed on this assignment.
· Save the file as T5.html
Bundle together all files and save the archive as A1_LastName_FirstName.zip. Upload the archive into the LMS using the A1 upload link.
1
Answered Same Day Nov 09, 2021

Solution

Arun Shankar answered on Nov 11 2021
141 Votes
A1_LastName_FirstName/Part 2/T5.html
__MACOSX/A1_LastName_FirstName/Part 2/._T5.html
A1_LastName_FirstName/Part 2/T4.html
__MACOSX/A1_LastName_FirstName/Part 2/._T4.html
A1_LastName_FirstName/Part 1/T3.html
__MACOSX/A1_LastName_FirstName/Part 1/._T3.html
A1_LastName_FirstName/Part...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here