Please find the complete HTML and Java-script code:
Create a HTML page with the following code.
To run the program, open the page in a web browser.
Enter 3 numbers in the the prompts.
HTML & JavaScript code:
<!DOCTYPE html>
<html>
<head>
<title>Webpage with JavaScript</title>
</head>
<body>
<h3>
<p id="description"> This page prompts 3
integers. Enter the numbers in the prompts.<br>
The page will calculate the maximum , minimum and
average of the 3 numbers.</p>
<p id="1"> Maximum number is displayed using
window.alert().</p>
<p id="2"> Minimum number is displayed using
document.write().</p>
<p id="3"> Average is displayed using
.innerHTML.</p>
</h3>
<h4><p
id="avg"></p></h4>
<script
type="text/javascript">
// variables
to hold the numbers
var firstNumber; // first number to be
entered
var secondNumber; // second number to be
entered
var thirdNumber; // third string to be
entered
var maximumNumber;
var minimumNumber;
// enter first number
firstNumber = prompt("Enter the number
1");
// enter second number
secondNumber = prompt("Enter the number
2");
// enter third number
thirdNumber = prompt("Enter the number 3");
// convert to integers using parseInt
firstNumber = parseInt(firstNumber);
secondNumber = parseInt(secondNumber);
thirdNumber = parseInt(thirdNumber);
//determine maximum,minimum and average
if (firstNumber >
secondNumber) {
if(firstNumber > thirdNumber)
maximumNumber = firstNumber ;
}
else if(secondNumber >
thirdNumber)
maximumNumber = secondNumber;
else maximumNumber =
thirdNumber;
window.alert(maximumNumber +
" is the maximum Number");
if (firstNumber <
secondNumber) {
if(firstNumber < thirdNumber)
minimumNumber = firstNumber ;
}
else if(secondNumber <
thirdNumber)
minimumNumber = secondNumber;
else minimumNumber =
thirdNumber;
document.write("<h4>" +
minimumNumber + " is the minimum Number <br>
</h4>");
var sum = firstNumber +
secondNumber + thirdNumber;
var average = sum / 3;
document.getElementById("avg").innerHTML = "Average of 3 numbers is
: " + average + "<br>";
</script>
</body>
</html>
Output of the Program Screen-shots
Hope this is helpful. Let me know if you need more information on this.
Write a complete webpage with JavaScript embedded at document level that 1) Read three positive integers...
Create two java programs. The first will ask the user to enter three integers. Once the three integers are entered, ask the user to enter one of three functions. The “average” if they want the average of the three numbers entered, enter “min” if they want the minimum and “max” if they want the maximum. Display the answer. Ask the user if they want to calculate another function for the three numbers. If so, loop and ask what function they...
C++
Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
Write a program that prompts the user to read three positive hex integers and display their sum in both hex and decimal. Your program should prompt the user to read the number again, if the input is incorrect. You must use java.lang.NumberFormatException. (chapter12.AddThreeHexNumbers.java)
This is my code so far: <!DOCTYPE html> <html> <head> <title>JavaScript is fun</title> <meta charset="utf-8" /> </head> <body> <script type ="text/javascript"> //declare a variable and store text in it var x = "JavaScript is fun"; //write the variable 5 times document.write(x + x + x + x + x); //store 5 as string in variable x x = "5"; //store 3 as string in variable y var y = "3"; //write the value x + y to the document document.write("<br>");...
C++ Write a program that reads three positive integers (> 0) from the command line (one at a time), then computes and prints the smallest entered number. Use if-else statements for three integer comparison. Example: Enter an integer: 5 Enter an integer: 23 Enter an integer: 7 The smallest number is: 5 Example 2: Enter an integer: 3 Enter an integer: 3 Enter an integer: 6 The smallest number is: 3 "The input must be positive number. The program should...
3. Write a C++ program that repeatedly inputs 50 positive integers that represent consumption of gas measured in gallons, one at a time. Use a loop to do the following steps: 1. Input the gas by calling a function named 'inputGas()' 'inputGas()' will not receive any parameters. It will input the gas and return it to the main function. 2. Convert the value of gallons to its liter equivalent by calling a function named 'convertToLiter'. 'convertToLiter' will receive an integer...
Write a program to read the contents of data.txt file, and determine the smallest value (min), largest value (max), and the average value (ave). The minimum, maximum, and average values must be calculated in the function calc(). Remember to declare the stdlib.h library, so that you can use the atof function, which will convert the number in the text file into float number. Also, remember to check if there is an error opening the file or not. If there is...
In C++ This program will read a group of positive numbers from three files ( not all necessarily the same size), and then calculate the average and median values for each file. Each file should have at least 10 scores. The program will then print all the scores in the order that they were input, showing each number and what percentage it is above or below the average for each file. Note: Finding the average doesn’t require an array. Finding...
Write a complete C++ program that is made of functions main() and rShift(). The rShift() function must be a function without return with 6 parameters. rShift() should do following. Shift the first 4 formal parameters' value one place to right circularly and send the updated values out to the caller function, i.e. main. Furthermore, after calling this function with first 4 actual parameters, say a1, a2, a3, a4, and these actual parameters should shift their value one place to right...
c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers into an array of capacity 100. The program will then ask for one of three letters(A, M or S). if the user inputs something other than one of these letters, then the program should ask for that input until an A, M, or S is entered. A do-while loop should be used for this. If the user inputs an A, then the program should...