Get fast, custom help from our academic experts, any time of day.
Place your order now for a similar assignment and have exceptional work written by our team of experts.
Secure Original On Schedule
Make a program to convert celsius tempatures to fahrenheit and vice versa, so we can complain about the weather with our friends overseas.
Reminder: To convert celsius to fahrenheit, multiply by 9, then divide by 5, then add 32. To convert fahrenheit to celsius, deduct 32, then multiply by 5, then divide by 9.
Unicode Characters: To print the degrees symbol in JavaScript, we need to use the write u00B0 to represent the unicode character for the degress symbol.
Requirements
Store a celsius temperature into a variable.
Convert it to fahrenheit and output “NN°C is NN°F” in an HTML field (don’t use alert)
Now store a fahrenheit temperature into a variable.
Convert it to celsius and output “NN°F is NN°C.” in an HTML field (don’t use alert)
JavaScript has a built-in tool that can generate a random number between 0 and 1. This tool is called a method. We’ll talk about methods more later in the class. For now, know if you type Math.random(), you’ll get a random number between 0 and 1.
Using this tool, update your fahrenheit to celsius tempature conversion program to do the following:
Instead of inputing a value for the Fahrenheit tempature, use Math.random() to generate a random tempature between 0 and 100
Have to program output: “It is NN°F today. That’s NN°C.” in an HTML field (don’t use alert)
NOTE: Submit your solution using JSFiddle (as demonstrated in the lecture)!Complete the following three exercises, making sure to adhere to all of the requirements.
Exercise 1
Write a JavaScript program to get the volume of a Cylinder with four decimal places using object classes. Volume of a cylinder : V = πr2h where r is the radius and h is the height of the cylinder.
Your solution must include an HTML and a JavaScript file, with a button to create the cylinder, inputs for the cylinder’s radius and height and an output to show the cyclinder’s volume.
Your solution must also use an object for the cylinder, a constructor for passing the radius and height, and a getter for returning the volume.
Exercise 2
Write a JavaScript program to display the reading status (i.e. display book name, author name and reading status) of the following books.
var
library
=
[
{ author: ‘Bill Gates’ , title: ‘The Road Ahead’, readingStatus: true },
{ author: ‘Steve Jobs’ , title: ‘Walter Isaacson’ , readingStatus: true },
{ title: ‘Mockingjay: The Final Book of The Hunger Games’ , author: ‘Suzanne Collins’ , readingStatus: false }];
Exercise 3
Write a JavaScript function to parse an URL. Your solution must use
var a = document.createElement(‘a’);
to create an anchor object.
Your solution should have a button to start the parsing, an input for the user to enter a URL, and four outputs for the following properties:
protocol
hostname
port
query
NOTE: Submit your three solutions using JSFiddle (as demonstrated in the lecture)!
Get fast, custom help from our academic experts, any time of day.
Secure Original On Schedule