/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Problem 44 (Check Protection) Computers are... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

(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. Weird amounts are printed by computerized check-writing systems, because of human error or machine failure. Systems designers build controls into their systems to prevent such 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 that 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, 12345678 (position numbers) On the other hand, if the amount is less than \)1000, then several of the spaces would ordinarily be left blank. For example, 99.87 \-------- 12345678 contains three blank spaces. If a check is printed with blank spaces, it is 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 program that inputs a dollar amount to be printed on a check and then prints the amount in check-protected format with leading asterisks if necessary. Assume that nine spaces are available for printing an amount.

Short Answer

Expert verified
Format the amount with leading asterisks to fill nine spaces.

Step by step solution

01

Understand the Problem

The task is to ensure that a dollar amount is printed on a check using a protected format. We need to fill any unused spaces with asterisks. In this scenario, we're given nine spaces to print the amount.
02

Prepare the Input

We assume that the input is a numeric value representing the dollar amount. This amount should be formatted to have exactly two decimal places for cents.
03

Format the Dollar Amount

Convert the input amount to a string with two decimal places (e.g., for $99.87, the string should be '99.87'). This ensures that the cents are always represented, even if they are zero (e.g., $100 becomes '100.00').
04

Determine Spaces Required

Calculate the number of actual spaces the formatted amount requires. For instance, '99.87' occupies five spaces and '1000.00' occupies seven spaces.
05

Calculate the Number of Asterisks Needed

Subtract the length of the amount from nine (the total number of spaces), leaving us with the number of asterisks needed to reach nine spaces. For instance, if the formatted amount '99.87' uses five spaces, then four asterisks are needed.
06

Construct the Protected Format

Combine the calculated number of asterisks with the formatted amount into a single string. For example, four asterisks followed by '99.87' results in '****99.87'.
07

Output the Check-Protected Amount

Print the final check-protected amount string. This ensures the check amount is secure against alterations.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91Ó°ÊÓ!

Key Concepts

These are the key concepts you need to understand to accurately answer the question.

Human Error Prevention
Human error is a leading cause of discrepancies in the payroll and finance sectors, especially when it comes to printing checks. Discrepancies may arise due to simple typing errors, misinterpretations, or oversight during processing. A key strategy in dealing with this is the implementation of preventive measures right at the software level.
  • Software-Enabled Checks: By embedding smart algorithms and automated checks into software, errors due to human oversight can be greatly minimized.
  • Verification Mechanisms: Verification mechanisms, such as double-entry checks or confirmation prompts, can reduce errors. When inputting critical data like check amounts, having an additional step ensures that any errors are caught early.
  • User Training: Proper training for users interacting with check-writing systems is crucial. Awareness and education about potential errors and their impacts can foster a more careful approach in data handling.
By focusing on these areas, organizations can significantly reduce the risk of errors before they cascade into larger issues.
Check Fraud Detection
Fraudulent activities targeting checks are a significant concern for financial operations. Protecting checks from fraud involves recognizing and mitigating unauthorized modifications.
  • Tamper-Evident Design: Designing checks with features that highlight any tampering is an effective deterrent. For example, using special ink or patterns that reveal alterations is one method.
  • Electronic Verification: Employing technological solutions such as verification codes or QR codes can add an extra layer of security. These can be unique to each check, making unauthorized reproductions ineffective.
The essence of check fraud detection lies in anticipating potential fraudulent methods and effectively countering them with proactive security designs.
Computerized Check-Writing Systems
Computerized check-writing systems have revolutionized financial operations by automating the check issuance process. These systems bring about efficiency, accuracy, and enhanced security.
  • Automation: Reducing manual entry by automating the entry of amounts minimizes the chances of errors and expedites the processing time.
  • Standardization: By standardizing the checks through software, organizations ensure that all checks adhere to a uniform template, reducing variations and potential errors.
  • Integration: Modern systems often integrate with accounting software, allowing for seamless transactions and real-time data validation.
With these systems, financial institutions can achieve higher levels of operational efficiency while safeguarding against erroneous checks.
Input Validation and Formatting
Input validation and formatting are critical processes in ensuring that the data entered into the system meets required specifications, reducing possible errors and fraudulent manipulations.
  • Validation Checks: A robust check-writing system should perform validation checks to make sure inputs meet specific criteria like non-empty fields, appropriate range, and proper formatting.
  • Consistent Formatting: Ensuring consistent formatting, especially in numerical data such as monetary values, aids in preventing errors. For example, always formatting values to two decimal places (e.g., '100.00') helps avoid misinterpretation.
  • Asterisk Padding: As the final deterrent against fraud, systems add padding with symbols like asterisks for amounts shorter than the designated field width to prevent illicit alteration.
Employing thorough validation routines and formatting guidelines ensures that check amounts remain within their intended structure, safeguarding them from unintentional changes.

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Write a program that uses function strcmp to compare two strings input by the user. The program should state whether the first string is less than, equal to or greater than the second string

Perform the task specified by each of the following statements: a. Write the function header for a function called exchange that takes two pointers to double-precision, floating-point numbers x and y as parameters and does not return a value. b. Write the function prototype for the function in part (a). c. Write the function header for a function called evaluate that returns an integer and that takes as parameters integer x and a pointer to function poly. Function poly takes an integer parameter and returns an integer. d. Write the function prototype for the function in part (c). e. Write two statements that each initialize character array vowel with the string of vowels, "AEIOU".

Write a program that inputs a line of text, tokenizes the line with function strtok and outputs the tokens in reverse order.

Write a program that uses function strncmp to compare two strings input by the user. The program should input the number of characters to compare. The program should state whether the first string is less than, equal to or greater than the second string. Write a program that uses random number generation to create sentences. The program should use four arrays of pointers to char called article, noun, verb and preposition. The program should create a sentence by selecting a word at random from each array in the following order: article, noun, verb, preposition, article and noun. As each word is picked, it should be concatenated to the previous words in an array that is large enough to hold the entire sentence. The words should be separated by spaces. When the final sentence is output, it should start with a capital letter and end with a period. The program should generate 20 such sentences.

(Quicksort) You have previously seen the sorting techniques of the bucket sort and selection sort. We now present the recursive sorting technique called Quicksort. The basic algorithm for a single-subscripted array of values is as follows: a. Partitioning Step: Take the first element of the unsorted array and determine its final location in the sorted array (i.e., all values to the left of the element in the array are less than the element, and all values to the right of the element in the array are greater than the element). We now have one element in its proper location and two unsorted subarrays. b. Recursive Step: Perform Step 1 on each unsorted subarray. Each time Step 1 is performed on a subarray, another element is placed in its final location of the sorted array, and two unsorted subarrays are created. When a subarray consists of one element, that subarray must be sorted; therefore, that element is in its final location. The basic algorithm seems simple enough, but how do we determine the final position of the first element of each subarray? As an example, consider the following set of values (the element in bold is the partitioning elementit will be placed in its final location in the sorted array): 37 2 6 4 89 8 10 12 68 45 a. Starting from the rightmost element of the array, compare each element with 37 until an element less than 37 is found. Then swap 37 and that element. The first element less than 37 is 12, so 37 and 12 are swapped. The values now reside in the array as follows: 12 2 6 4 89 8 10 37 68 45 Starting from the left of the array, but beginning with the element after 12, compare each element with 37 until an element greater than 37 is found. Then swap 37 and that element. The first element greater than 37 is 89, so 37 and 89 are swapped. The values now reside in the array as follows: 12 2 6 4 37 8 10 89 68 45 Starting from the right, but beginning with the element before 89, compare each element with 37 until an element less than 37 is found. Then swap 37 and that element. The first element less than 37 is 10, so 37 and 10 are swapped. The values now reside in the array as follows: 12 2 6 4 10 8 37 89 68 45 Starting from the left, but beginning with the element after 10, compare each element with 37 until an element greater than 37 is found. Then swap 37 and that element. There are no more elements greater than 37, so when we compare 37 with itself, we know that 37 has been placed in its final location of the sorted array. Once the partition has been applied to the array, there are two unsorted subarrays. The subarray with values less than 37 contains 12, 2, 6, 4, 10 and 8. The subarray with values greater than 37 contains 89, 68 and 45. The sort continues with both subarrays being partitioned in the same manner as the original array. Based on the preceding discussion, write recursive function quickSort to sort a single subscripted integer array. The function should receive as arguments an integer array, a starting subscript and an ending subscript. Function partition should be called by quickSort to perform the partitioning step

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.