Question: ( 2 ) Complete the project # 9 , 'Validating a PIN' on page 2 4 0 . Make use of procedures to separate out

(2) Complete the project #9, 'Validating a PIN' on page 240. Make use of procedures to separate out the functionality. Upload the asm file and output for a couple of runs. Allow the user to enter a 5 digit number. One run should be for valid input and another for invalid input. Print the appropriate message.
Validating a PIN
Banks use a Personal Identification Number (PIN) to uniquely identify each
customer. Let us assume that our bank has a specified range of acceptable values for each digit in its customers' 5-digit PINs. The table shown below contains the acceptable ranges, where digits are numbered from left to right in the PIN. Then we can see that the PIN 52413 is valid. But the PIN 43534 is invalid because the first digit is out of range. Similarly, 64535 is invalid because of its last digit.
Digit Number Range 1 through 5 to 9 with ranges 2 to 5,4 to 8,1 to 4,3 to 6 Your task is to create a procedure named Validate_PIN that receives a pointer to an array of byte containing a 5-digit PIN. Declare two arrays to hold the minimum and maximum range values, and use these arrays to validate each digit of the PIN that was passed to the procedure. If any digit is found to be outside its valid range, immediately return the digit's position (between 1 and 5) in the EAX register. If the entire PIN is valid, return 0 in EAX. Preserve all other register values between calls to the procedure. Write a test program that calls Validate_PIN at least four times, using both valid and invalid byte arrays. By running the program in a debugger, verify that the return value in EAX after each procedure call is valid. Or, if you prefer to use the book's library, you can display "Valid" or "Invalid" on the console after each procedure call. NOTE: Upload an image showing the results of the valid and invalid strings.
(3) Create a Guessing game. Create procedures to -
(a) Generate a random number between 1 and 100.
(b) To prompt the user for a guess.
(c) To provide feedback as appropriate.
Make sure only sufficient tries given and no more.
Include sample runs for all the possible scenarios.
NOTE: Upload an image showing the results of the winning \& losing games. Not just the final but come but all the steps up to the final out come.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!