Question

In: Computer Science

For this question you will need to use the following library function: Math.floor(x) returns the largest...

For this question you will need to use the following library function: Math.floor(x) returns the largest whole number less than or equal to x Define a function named weight which has one input. The input is a Number representing a person's weight in pounds. Your function will calculate and return a string saying how much they weigh in stone. Your function should start by multiplying the input by 0.0714286. Because stone weight is always a whole number, your function will need to use the Math.floor to get the whole number portion of that product. The function needs to return a String with the text You weigh ______ stone (replacing the underscores with the weight in stone your function calculated). in Java script please.

Solutions

Expert Solution

Pounds to Stone Weight Conversion

Code:

<!DOCTYPE html>

<html>

    <title>Weight Converter</title>

    <body style="text-align: center;">

        <h2 style="margin-top: 200px;">

            Weight Converter

        </h2>

        <p>

            Please enter an input value in pounds

        </p>

        <p>

            <label>

                Input value

            </label>

            <input id="ipPounds" type="number" placeholder="Pounds" oninput="Weight(this.value)" onchange="Weight(this.value)">

        </p>

        <p>

            You weigh <span id="opStones"></span> stones

        </p>

        <script>

            function Weight(valNum) {

            document.getElementById("opStones").innerHTML = Math.floor(valNum*0.0714286);

            }

        </script>

</body>

</html>

Output:


Related Solutions

Write a function that returns the largest value in a stack (only use push and pop)
Write a function that returns the largest value in a stack (only use push and pop)
Use the following returns for X and Y. Returns Year X Y 1 21.9 % 26.7...
Use the following returns for X and Y. Returns Year X Y 1 21.9 % 26.7 % 2 – 16.9 –3.9 3 9.9 28.7 4 19.8 –14.8 5 4.9 32.7 Calculate the average returns for X and Y. (Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.) Average returns X % Y %    Calculate the variances for X and Y. (Do not round intermediate calculations and round your answers...
Use the following returns for X and Y. Returns Year X Y 1 22.0 % 27.0...
Use the following returns for X and Y. Returns Year X Y 1 22.0 % 27.0 % 2 – 17.0 – 4.0 3 10.0 29.0 4 20.0 – 15.0 5 5.0 33.0 Requirement 1: Calculate the average returns for X and Y. (Do not round intermediate calculations. Enter your answers as a percentage rounded to 2 decimal places (e.g., 32.16).) Average returns X % Y % Requirement 2: Calculate the variances for X and Y. (Do not round intermediate calculations....
C Program: Write your own stringLength function (without calling a pre-written library function) that returns the...
C Program: Write your own stringLength function (without calling a pre-written library function) that returns the length of the string argument in characters, not including the terminating ‘\0’ character.   Write four versions of a void printString function (i.e., printString1, printString2, etc) each of which prints its string argument character-by-character but using the following techniques: printString1: array indexing printString2: pointer/offset with the array name as a pointer, printString3: pointer indexing, and printString4: pointer/offset with a pointer Write a void function called...
Please write code in c++. Use iostream (and any string library if you need it). Create...
Please write code in c++. Use iostream (and any string library if you need it). Create s structure plane : First line contains n(0 < n < 1001). Then n lines inputed in given format:   First - ID[int type]   Second - FromLocation[char*]   Third - ToLocation[char*]   Fourth - DepartureTime[char*] Output: Sorted list of planes should be in UPPER CASE. Example of input:(it's just one of an examples, you need to write code generally) 10 40 Shuch Satp 05:47 89 Kyzy Taldy  07:00...
You may need to use the appropriate technology to answer this question. The following data are...
You may need to use the appropriate technology to answer this question. The following data are from a completely randomized design. Treatment A B C 161 143 126 143 157 121 164 125 137 144 141 139 149 137 151 169 143 124 Sample mean 155 141 133 Sample variance 122.8 107.2 130.0 (a) Compute the sum of squares between treatments. (b) Compute the mean square between treatments. (c) Compute the sum of squares due to error. (d) Compute the...
note: USE C++ WITH USER DEFINED FUNCTIONS AND RECURSIVE FUNCTION ONLY. No C++ library function is...
note: USE C++ WITH USER DEFINED FUNCTIONS AND RECURSIVE FUNCTION ONLY. No C++ library function is allowed. The game of “Jump It” consists of a board with n positive integers in a row, except for the first column, which always contains zero. These numbers represent the cost to enter each column. Here is a sample game board where n is 6: 0 3 80 6 57 10 The object of the game is to move from the first column to...
You may need to use the appropriate technology to answer this question. Consider the following data...
You may need to use the appropriate technology to answer this question. Consider the following data for a dependent variable y and two independent variables, x1 and x2. x1 x2 y 30 12 93 47 10 108 25 17 112 51 16 178 40 5 94 51 19 175 74 7 170 36 12 117 59 13 142 76 16 212 The estimated regression equation for these data is ŷ = −19.56 + 2.03x1 + 4.76x2. Here, SST = 15,418.9,...
You may need to use the appropriate technology to answer this question. Consider the following data...
You may need to use the appropriate technology to answer this question. Consider the following data on price ($) and the overall score for six stereo headphones tested by a certain magazine. The overall score is based on sound quality and effectiveness of ambient noise reduction. Scores range from 0 (lowest) to 100 (highest). Brand Price ($) Score A 180 74 B 150 71 C 95 59 D 70 56 E 70 40 F 35 24 (a) The estimated regression...
You may need to use the appropriate technology to answer this question. The following table contains...
You may need to use the appropriate technology to answer this question. The following table contains observed frequencies for a sample of 200. Row Variable Column Variable A B C P 18 42 48 Q 32 28 32 Test for independence of the row and column variables using α = 0.05. State the null and alternative hypotheses. H0: Variable P is independent of variable Q. Ha: Variable P is not independent of variable Q.H0: The column variable is independent of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT