<script>
var name = prompt("Your name:", "");
var age = parseInt(prompt("Hello " + name + ", What is your
age?"));
var days = age * 365;
alert("You have lived for over " + days + " days");
//If you want to print on the page then you can use the below
line
//document.write("You have lived for over " + days + " days");
if(age < 21)
{
alert("You are not an adult");
//document.write("You are not an adult");
}
else
{
alert("You are an adult");
//document.write("You are an adult");
}
</script>
Example:

design a program (.js extension) using JS Language The program should ask the user for their...
Write a program that ask the user for the year he/she was born, then outputs "Hi" if the user is less than 18 years old but "Hello" if the user is 18 or older. The program should print "Bye" at the end. cpp.
Q1: Write a Java program that will display different messages depending on your age. Your program should ask the user for his/her name and their age in years and give one or more answers from the following ones below: if the age of the user is less than 16, the program should print on the screen “You are not allowed to drive at the moment”. if the age of the user is less than 18, the program should print on...
write using C language
Part A: Using any loop statement Ask the user to enter first name and last name Read the characters the user typed using getchar) function. While reading you have to make sure you ignore the end of line statement. Print the characters on the screen using putchar () function and in this format First Name:Jack Last Name:Damon
java; programing language Write a program to calculate the price of a purchase. It should ask the user to enter the name of the item bought (like sweater, apple, …), number of items bought (4, 5 lbs,…), price per item ($40.50, $1.99 per pound,…), and the sales tax rate (8.35% for example). It should calculate the subtotal (price*number of items), sales tax (subtotal*sales tax), and total price (subtotal+ sales tax). It should print all the information in a receipt form
Use python and use if, elif and else statements. Thank you! The program should first ask the user if they are a hero or a villain. If they enter “villain”, the program should ask them their name; if they enter “hero”, it should ask how many people they have saved, and respond to that information. Using decision structures, have your program execute certain print statements following these rules: If they enter that they are a villain Ask for their name...
Using java program, create a Username class. ask user to type username 1)username length have to >1 and <15 2)username can not include any special character (ex.!@##$}{|\....) ,but it also have to type Spanish or other foreign language 3)user can not include any empty space (ex. user name) all of three error have to print out. and if there is any error contains, have to ask user to input user name again. for example: input username: #$%he f username can't...
Design a modular program using pseudo-code which prompts a user for their first name, followed by their last name; then displays a "Hello" salutation which concatenates their first name with their last name. Sample output (user input shown in red): Please enter your first name: John Please enter your last name: Smith Hello, John Smith! Your program must include a main module and one function; this function prompts the user for either their first name or last name, using a...
Simple calculator program. The program should ask the user for a number, an operator, and then a second number. The operator should be either '+', '-', 'x', or '/'. The program should then report the answer to the problem. Use a switch statement, not an if statement. Note that "operator" is a reserved word in C++, so you cannot use it as a variable name. Use double variables and setprecision(2).
USING C LANGUAGE
Write a program that computes the total weight of a cargo. Ask the user to enter multiple inputs. For each input, the user indicate the weight and quantity of the boxes. The program computes and prints the total cargo weight The output should match the sample below. Make sure you print the input number (Input #1, Input #2,) 3 - Input # 1. Weight of the box (lbs): 4 Enter quantity: 2 Input #2. Weight of the...
Create a program that will ask for the name, age, address, and
favorite food of the user. After which, create a calculator with
ADD, SUB, MULTI, and DIV. Then the program will display all the
user have inputted in bash program
ACTIVITY 4: Create a program that will ask for the name, age, address, and favorite food of the user. After which create a calculator with ADD, SUB, MULTI, and DIV. Then the program will display all the user have...