'F' → Fullscreen
Create a new JavaScript file named 1-8-numeric-input.js.
parseInt().console.log("--- Demo 1 - Age to Months Calculator ---");
let age = parseInt(prompt("Enter your age:"));console.log(`You are ${age} years old. That's ${age * 12} months old!`);
alert("Press enter to continue...");parseFloat().console.log("--- Demo 1 - Age to Months Calculator ---");
let age = parseInt(prompt("Enter your age:"));console.log(`You are ${age} years old. That's ${age * 12} months old!`);
alert("Press enter to continue...");
console.log("--- Demo 2 - Square Area Calculator ---");
let length = parseFloat(prompt("Enter the length of the square:"));let area = length * length;console.log(`The area of the square is ${area}`);
alert("Press enter to continue...");parseFloat().console.log("--- Demo 1 - Age to Months Calculator ---");
let age = parseInt(prompt("Enter your age:"));console.log(`You are ${age} years old. That's ${age * 12} months old!`);
alert("Press enter to continue...");
console.log("--- Demo 2 - Square Area Calculator ---");
let length = parseFloat(prompt("Enter the length of the square:"));let area = length * length;console.log(`The area of the square is ${area}`);
alert("Press enter to continue...");
console.log("--- Demo 3 - Score Calculator ---");
let score1 = parseFloat(prompt("Enter the score for game 1:"));let score2 = parseFloat(prompt("Enter the score for game 2:"));let score3 = parseFloat(prompt("Enter the score for game 3:"));let totalScore = score1 + score2 + score3;console.log(`Your total score for the three games is ${totalScore}!`);
alert("Press enter to continue...");parseFloat().console.log("--- Demo 1 - Age to Months Calculator ---");
let age = parseInt(prompt("Enter your age:"));console.log(`You are ${age} years old. That's ${age * 12} months old!`);
alert("Press enter to continue...");
console.log("--- Demo 2 - Square Area Calculator ---");
let length = parseFloat(prompt("Enter the length of the square:"));let area = length * length;console.log(`The area of the square is ${area}`);
alert("Press enter to continue...");
console.log("--- Demo 3 - Score Calculator ---");
let score1 = parseFloat(prompt("Enter the score for game 1:"));let score2 = parseFloat(prompt("Enter the score for game 2:"));let score3 = parseFloat(prompt("Enter the score for game 3:"));let totalScore = score1 + score2 + score3;console.log(`Your total score for the three games is ${totalScore}!`);
alert("Press enter to continue...");
console.log("--- Demo 4 - Shopping Cart Subtotal ---");
let item1Price = parseFloat(prompt("Enter the price of the first item:"));let item2Price = parseFloat(prompt("Enter the price of the second item:"));let subtotal = item1Price + item2Price;console.log(`The subtotal for your two items is $${subtotal}.`);
alert("Press enter to continue...");parseFloat().console.log("--- Demo 1 - Age to Months Calculator ---");
let age = parseInt(prompt("Enter your age:"));console.log(`You are ${age} years old. That's ${age * 12} months old!`);
alert("Press enter to continue...");
console.log("--- Demo 2 - Square Area Calculator ---");
let length = parseFloat(prompt("Enter the length of the square:"));let area = length * length;console.log(`The area of the square is ${area}`);
alert("Press enter to continue...");
console.log("--- Demo 3 - Score Calculator ---");
let score1 = parseFloat(prompt("Enter the score for game 1:"));let score2 = parseFloat(prompt("Enter the score for game 2:"));let score3 = parseFloat(prompt("Enter the score for game 3:"));let totalScore = score1 + score2 + score3;console.log(`Your total score for the three games is ${totalScore}!`);
alert("Press enter to continue...");
console.log("--- Demo 4 - Shopping Cart Subtotal ---");
let item1Price = parseFloat(prompt("Enter the price of the first item:"));let item2Price = parseFloat(prompt("Enter the price of the second item:"));let subtotal = item1Price + item2Price;console.log(`The subtotal for your two items is $${subtotal}.`);
alert("Press enter to continue...");
console.log("--- Demo 5 - Hours to Minutes Converter ---");
let hours = parseFloat(prompt("Enter a number of hours:"));let minutes = hours * 60;console.log(`${hours} hours is equal to ${minutes} minutes.`);Verify your program works correctly.
--- Demo 1 - Age to Months Calculator ---Enter your age: 35You are 35 years old. That's 420 months old!Press enter to continue... [Enter]
--- Demo 2 - Square Area Calculator ---Enter the length of the square: 11.5The area of the square is 132.25Press enter to continue... [Enter]
--- Demo 3 - Score Calculator ---Enter the score for game 1: 45Enter the score for game 2: 64Enter the score for game 3: 99Your total score for the three games is 208!Press enter to continue... [Enter]
--- Demo 4 - Shopping Cart Subtotal ---Enter the price of the first item: 12.50Enter the price of the second item: 10The subtotal for your two items is $22.5.Press enter to continue... [Enter]
--- Demo 5 - Hours to Minutes Converter ---Enter a number of hours: 1212 hours is equal to 720 minutes.Answer the following questions before submitting your work.
prompt() always give back a string, even if the user types a number?parseInt() and parseFloat()? When would you use one over the other?parseFloat("banana") would return? What might happen if you tried to do math with that result?Submit the required files to the appropriate dropbox.