* Example B.1: Display an input box to user with the message “Please enter your name”. Store the entered value in the variable ‘person’
var person = prompt(“Please enter your name”, “”);
* Example C.1: Display an output box to user with the message “Go USA!!!”.
* Example C.2: Initialize a variable country to value “USA”. Then display an output box to user with the message “Go <countryname>!!!”.
country = “USA”;
alert(“Go ” + country + “!!!”);
var name; //Declare a variable wothout specifying data type
var lastname = “Smith”; //Initialize a string variable without specying data type
var rate = new Number(7.5); //Initialize a decimal number
var month = new Number(); //Declare an integer
var greeting = new String(“Hello Friend”); //Initialize a String
1. TEXAN GREETER.1: Write a program that uses standard greeting to greet users. Following are the requirement.
R1-1) Always use the greeting ‘Howdy Partner’ when communication with user (input or output message)
R1-2) Ask the user their name with an input box this way: “Howdy Partner, what is your name?”
R1-3) After reading the user’s name, greet them with their name. For example if user entered ‘Bob’ display output: “Howdy Partner Bob!”
2. PAYCALC.1: Write a program to calculate weekly salary
R2-1) Assume current payrate is $7.75 per hour
R2-2) Ask the user how many hours they worked this week: “Enter number of hours worked this week:”
R2-3) weeklysalary = payrate * hours
R2-4) Display total salary this way: “Your salary for this week is: <SALARY>”
NOTE: <SALARY> is a place-holder for the actual salary.
3. PAYCALC.2: Write a program to calculate annual salary
R3-1) Assume current payrate is $7.75 per hour. Also there are 52 weeks in a year.
R3-2) Ask the user how many works they worked this week: “Enter number of hours worked this week:”
R3-3) weekly salary = payrate * hours
R3-4) annual salary = weekly salary * total weeks in a year
R3-5) Display total salary this way: “Your annual salary before taxes is: $<SALARY>”
NOTE: <SALARY> is a placeholder for the actual salary.
NOTE: Don’t forget to show the $ sign in the output to make it look nice!