Media Computation Skills Lab

MTEC 1003

Lab 6 / Part 1 - JavaScript Basics

In this lab, you’ll be creating several programs:

  1. say twice
  2. shout
  3. temperature
  4. miles

Instructions

Setup

ProTip: Bookmark the following page so that you can easily repeat these steps in your future labs!

Cloning a Remote Repo Using Your GitHub API Access Token


say twice

Write a program that takes user input and repeats the user input twice (both words on the same line) in the JavaScript console.

(prompt) Give me a word to say twice
> hello
hello hello

shout

Write a program that takes user input and repeats the user input, but with three exclamation points afterwards.

(prompt) Give me a word, and I'll shout it out
> yeah
yeah!!!

temperature

Write a program that calculates celsius to fahrenheit based on user input.

(prompt) Please enter a temperature in celsius
> 37
37 degrees celsius is 98 degrees fahrenheit

miles

Write a program that calculates miles-per-gallon based on user input for miles driven and gallons of gas used.

(prompt) How many miles did you drive?
>20
(prompt) How many gallons of gas did you use?
>2
Your car gets 10.0 miles per gallon.

MTEC 1003 - Media Computation Skills Lab 2 - Spring 2015