'F' → Fullscreen
greetUser(name) that prints
a personalized greeting. function greetUser(name) { console.log("Hello, " + name + "!"); console.log("Welcome to the Math Utility Program."); console.log();}
console.log("--- Math Utilities ---");
let userName = prompt("Enter your name: ");greetUser(userName);square(n) that returns the square
of a number. square(num), and
print the result. function greetUser(name) { console.log("Hello, " + name + "!"); console.log("Welcome to the Math Utility Program."); console.log();}
function square(n) { return n * n;}
console.log("--- Math Utilities ---");
let userName = prompt("Enter your name: ");greetUser(userName);
let num = parseInt(prompt("Enter a number to square: "));let result = square(num);
console.log("The square is " + result);console.log();average(a, b) that returns
the average of two numbers. randomInRange(min, max) to
return a random integer between two values. function greetUser(name) { console.log("Hello, " + name + "!"); console.log("Welcome to the Math Utility Program."); console.log();}
function square(n) { return n * n;}
function average(a, b) { return (a + b) / 2;}
function randomInRange(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min;}
console.log("--- Math Utilities ---");
let userName = prompt("Enter your name: ");greetUser(userName);
let num = parseInt(prompt("Enter a number to square: "));let result = square(num);console.log("The square is " + result);console.log();
let a = parseFloat(prompt("Enter first number: "));let b = parseFloat(prompt("Enter second number: "));let avg = average(a, b);console.log("The average is " + avg);console.log();
let min = parseInt(prompt("Enter minimum value: "));let max = parseInt(prompt("Enter maximum value: "));let random = randomInRange(min, max);console.log("Random number between " + min + " and " + max + ": " + random);Your program output should look similar to the example below.
Enter your name: AnthonyHello, Anthony!Welcome to the Math Utility Program.
Enter a number to square: 6The square is 36
Enter first number: 8Enter second number: 10The average is 9
Enter minimum value: 1Enter maximum value: 10Random number between 1 and 10: 4You may write your reflection answers as comments at the bottom of your code.
return statement?
Submit your completed .js file and reflection answers
to the appropriate dropbox.