Javascript / html Check Protection) Computers are frequently employed in check-w
ID: 3600608 • Letter: J
Question
Javascript / html Check Protection) Computers are frequently employed in check-writing systems such as payroll and accounts payable applications. Many strange stories circulate regarding weekly paychecks being printed (by mistake) for amounts in excess of $1 million. Incorrect amounts are printed by computerized check-writing systems because of human error and/or machine failure. Systems designers build controls into their systems to prevent erroneous checks from being issued. Another serious problem is the intentional alteration of a check amount by someone who intends to cash a check fraudulently. To prevent a dollar amount from being altered, most computerized check-writing systems employ a technique called check protection. Checks designed for imprinting by computer contain a fixed number of spaces in which the computer may print an amount. Suppose a paycheck contains eight blank spaces in which the computer is supposed to print the amount of a weekly paycheck. If the amount is large, then all eight of those spaces will be filled, for example
1,230.60
--------
12345678 (position numbers)
On the other hand, if the amount is less than $1000, then several of the spaces will ordinarily be left blank. For example,
99.87
--------
12345678
contains three blank spaces. If a check is printed with blank spaces, it’s easier for someone to alter the amount of the check. To prevent a check from being altered, many check-writing systems insert leading asterisks to protect the amount as follows:
***99.87
--------
12345678
Write a script that inputs a dollar amount to be printed on a check, then prints the amount in check-protected format with leading asterisks if necessary. Assume that nine spaces are available for printing the amount.
Explanation / Answer
Ans.)
Please find the script embedded in the HTML, as folows :
<!DOCTYPE html>
<html>
<body>
Enter your name: <input type="text" id="fname">
<script>
function myFunction() {
var x = document.getElementById("fname");
while(x.value.length<8){
x.value="*"+x.value;
}
}
</script>
</body>
</html>
For any queries, drop a comment.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.