Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that verifies cheques deposited into an ATM. Each cheque has an amount and a written amount. The OCR software will read the
Write a program that verifies cheques deposited into an ATM. Each cheque has an amount and a written amount. The OCR software will read the hand-written or printed amounts and convert them into text, you are to then analyze the text to make sure the two amounts match.
Java with Clear Image
Mobile Deposit Cheque Validator Write a program that verifies cheques deposited into an ATM. Each cheque has an amount and a written amount. The OCR software will read the hand-written or printed amounts and convert them into text, you are to then analyze the text to make sure the two amounts match. For example on the following cheques the OCR software would return the text shown below: ANDREA'S GARDEN SERVICES 1100 0630/2012 Beda's Mower Wholesale Our hundred for dollar and 25/100 Incorrect Cheque m P00110 4765610 567891216 ANDREA'S GARDOS SERVICES 0630/2012 35.58 Chris Garden Supplies Two bundred thirty-five dollars 100 0011087 498765410 55709-12 ANDREA'S GARDEN SERVICES 1190 0630/2012 Cathy's Landscaping Fifty dollars and 15.00 Takaful Sayur m F0011087 4987654320 567891234 Beth's Flower Wholesale $***150.25 One-hundred fifty-four dollars and 25/100*** Chris Garden Supplies $***235.89 Two-hundred thirty-five dollars and 88/100** Cathy's Landscaping $****50.25 Fifty dollars and 25/100*** 1100 ANDREA'S GARDEN SERVICES 123 Antown, USA 12355 06/30/2012 $ 150.25 PNY me Beth's Flower Wholesale CEIRO One-hundred fifty-four dollars and 25/100 DOLLS Incorrect Cheque Bank of California 123 Anna Street Aytem. CA 12345 P001106 9876543 204: 5678901236 1100 ANDREA'S GARDEN SERVICES 12 Min. Anton, USA 1235 06/30/2012 S***235.88 PNY One Chris Garden Supplies CRER OF Tiro-randred thirty-five dollars and 88/100*** DOLLS Bank of California 113 Anyire Strait Aytem. CA 12345 001 206 9876543 20:56 789-1236 1110 ANDREA'S GARDEN SERVICES 123 Min. Anyhow, USA 12345 06/30/2012 $***50.25 OER OP Ne Cathy's Landscaping Fifty dollars and 25/100*** DOLL Bank of Clara 173 Anyone Street Layton, CA 12345 hr 001106 987654320: 56789-13 Mobile Deposit Cheque Validator Your program should input two lines from the user and continue analyzing the cheques until the user types "exit" on the 1st input line. Your program should work for ALL amounts from $0.01 to $999.99. Additional comments: The numeric amounts will NOT have commas (e.g. $5421.23 NOT $5,421.33) The word description MAY or MAY NOT include a "-" between the words The word "and" is optional between the dollar amount and cent amount in the word description Sometimes people will write "xx/100" in the word description to indicate 0 cents. Mobile Deposit Cheque Validator Tips and Tricks The following sample program shows how to read individual components: string from the keyboard, create a Scanner object on that String and how to parse the String into its Source Code: import java.util.*; public class ScanningStrings { public static void main (String [] args) { 11 Scanner attached to the keyboard Scanner in = new Scanner (System.in); String wordAmount; System.out.print ("Enter the word amount of the cheque: "); wordAmount = in.nextLine(); // check to see if the line contains "hundred" boolean contains Hundred; String hundreds Digit=""; // Attach a Scanner object to the input string Scanner cheqscanner = new Scanner (wordAmount); containsHundred = wordAmount.contains ("hundred"); if (containsHundred) { // the cheque has a hundreds amount read the digit hundreds Digit = cheqscanner.next(); // read the discard the word "hundred" cheqscanner.next(); 1/ read the remainder of the String till the end of line String remainder = cheqscanner.nextLine(); System.out.printf ("Hundreds digit was: %$n", hundreds Digit); System.out.printf ("Remainder of the line is: $stn", remainder); Sample Run (User input in bold underline) : Enter the word amount of the cheque: One hundred fifty four dollars and 25/100******* Hundreds digit was: One Remainder of the line is: fifty four dollars and 25/100** Mobile Deposit Cheque Validator Test Data Run your program against the following test data. You can cut and paste it into the Blues Terminal Window to reduce typing. Valid cheques Fred's Pennies $***0.01 01/100** Bigtata $***999.89 Nine Hundred and Ninety Nine 89/100****** Palm Desert Resort Golf $***35.38 Thirty-Five 38/100******* Jake's Sushi Palace ****15.00 Fifteen xx/100 Wertswatex Park $****60.23 Sixty and 23/100 Invalid cheques The Big Apple $*****213.55 Two Thirteen Hundred 55/100** ATV Adventures Five Hundred Four Hundred Ten 00/100 Joshua climbing Adventures $***895.00 Eight Hundred Mobile Deposit Cheque Validator Sample run (user input is shown in Bold Underline): Enter the 1st line of the cheque to deposit (exit to quit): Fred's Pennies $***0.01 Enter the 2nd line of the cheque: 01/100************************************************* Numeric amount and word amount match! Cheque amount deposited is $0.01 Enter the 1st line of the next cheque to deposit (exit to quit): BigLots $***999.89 Enter the 2nd line of the cheque: Nine Hundred and Ninety Nine 89/100****** Numeric amount and word amount match! Cheque amount deposited is $999.89 Enter the 1st line of the next cheque to deposit lexit to quit): Palm Desert Resort Golf $***35.38 Enter the 2nd line of the cheque: Thirty-Five 38/100************************************* Numeric amount and word amount match! Cheque amount deposited is $35.38 Enter the 1st line of the next cheque to deposit (exit to quit): Jake's Sushi Palace $***15.00 Enter the 2nd line of the cheque: Fifteen xx/100 Numeric amount and word amount match! Cheque amount deposited is $15.00 Enter the 1st line of the next cheque to deposit (exit to quit): Worldwater Park $****60.23 Enter the 2nd line of the cheque: Sixty and 23/100 Numeric amount and word amount match! Cheque amount deposited is $60.23 Enter the 1st line of the next cheque to deposit (exit to quit): The Big Apple $*****213.55 Enter the 2nd line of the cheque: Two Thirteen Hundred 55/100***** ERROR: numeric amount and word amount DON'T MATCH. Auto Deposit rejected. Enter the 1st line of the next cheque to deposit (exit to quit): ATV Adventures Enter the 2nd line of the cheque: Five Hundred Four Hundred Ten 00/100 ERROR: numeric amount and word amount DON'T MATCH. Auto Deposit rejected. Enter the 1st line of the next cheque to deposit (exit to quit): Joshua Climbing Adventures $***895.00 Enter the 2nd line of the cheque: Eight Hundred ERROR: numeric amount and word amount DON'T MATCH. Auto Deposit rejected. Enter the 1st line of the next cheque to deposit (exit to quit): exit Mobile Deposit Cheque Validator Write a program that verifies cheques deposited into an ATM. Each cheque has an amount and a written amount. The OCR software will read the hand-written or printed amounts and convert them into text, you are to then analyze the text to make sure the two amounts match. For example on the following cheques the OCR software would return the text shown below: ANDREA'S GARDEN SERVICES 1100 0630/2012 Beda's Mower Wholesale Our hundred for dollar and 25/100 Incorrect Cheque m P00110 4765610 567891216 ANDREA'S GARDOS SERVICES 0630/2012 35.58 Chris Garden Supplies Two bundred thirty-five dollars 100 0011087 498765410 55709-12 ANDREA'S GARDEN SERVICES 1190 0630/2012 Cathy's Landscaping Fifty dollars and 15.00 Takaful Sayur m F0011087 4987654320 567891234 Beth's Flower Wholesale $***150.25 One-hundred fifty-four dollars and 25/100*** Chris Garden Supplies $***235.89 Two-hundred thirty-five dollars and 88/100** Cathy's Landscaping $****50.25 Fifty dollars and 25/100*** 1100 ANDREA'S GARDEN SERVICES 123 Antown, USA 12355 06/30/2012 $ 150.25 PNY me Beth's Flower Wholesale CEIRO One-hundred fifty-four dollars and 25/100 DOLLS Incorrect Cheque Bank of California 123 Anna Street Aytem. CA 12345 P001106 9876543 204: 5678901236 1100 ANDREA'S GARDEN SERVICES 12 Min. Anton, USA 1235 06/30/2012 S***235.88 PNY One Chris Garden Supplies CRER OF Tiro-randred thirty-five dollars and 88/100*** DOLLS Bank of California 113 Anyire Strait Aytem. CA 12345 001 206 9876543 20:56 789-1236 1110 ANDREA'S GARDEN SERVICES 123 Min. Anyhow, USA 12345 06/30/2012 $***50.25 OER OP Ne Cathy's Landscaping Fifty dollars and 25/100*** DOLL Bank of Clara 173 Anyone Street Layton, CA 12345 hr 001106 987654320: 56789-13 Mobile Deposit Cheque Validator Your program should input two lines from the user and continue analyzing the cheques until the user types "exit" on the 1st input line. Your program should work for ALL amounts from $0.01 to $999.99. Additional comments: The numeric amounts will NOT have commas (e.g. $5421.23 NOT $5,421.33) The word description MAY or MAY NOT include a "-" between the words The word "and" is optional between the dollar amount and cent amount in the word description Sometimes people will write "xx/100" in the word description to indicate 0 cents. Mobile Deposit Cheque Validator Tips and Tricks The following sample program shows how to read individual components: string from the keyboard, create a Scanner object on that String and how to parse the String into its Source Code: import java.util.*; public class ScanningStrings { public static void main (String [] args) { 11 Scanner attached to the keyboard Scanner in = new Scanner (System.in); String wordAmount; System.out.print ("Enter the word amount of the cheque: "); wordAmount = in.nextLine(); // check to see if the line contains "hundred" boolean contains Hundred; String hundreds Digit=""; // Attach a Scanner object to the input string Scanner cheqscanner = new Scanner (wordAmount); containsHundred = wordAmount.contains ("hundred"); if (containsHundred) { // the cheque has a hundreds amount read the digit hundreds Digit = cheqscanner.next(); // read the discard the word "hundred" cheqscanner.next(); 1/ read the remainder of the String till the end of line String remainder = cheqscanner.nextLine(); System.out.printf ("Hundreds digit was: %$n", hundreds Digit); System.out.printf ("Remainder of the line is: $stn", remainder); Sample Run (User input in bold underline) : Enter the word amount of the cheque: One hundred fifty four dollars and 25/100******* Hundreds digit was: One Remainder of the line is: fifty four dollars and 25/100** Mobile Deposit Cheque Validator Test Data Run your program against the following test data. You can cut and paste it into the Blues Terminal Window to reduce typing. Valid cheques Fred's Pennies $***0.01 01/100** Bigtata $***999.89 Nine Hundred and Ninety Nine 89/100****** Palm Desert Resort Golf $***35.38 Thirty-Five 38/100******* Jake's Sushi Palace ****15.00 Fifteen xx/100 Wertswatex Park $****60.23 Sixty and 23/100 Invalid cheques The Big Apple $*****213.55 Two Thirteen Hundred 55/100** ATV Adventures Five Hundred Four Hundred Ten 00/100 Joshua climbing Adventures $***895.00 Eight Hundred Mobile Deposit Cheque Validator Sample run (user input is shown in Bold Underline): Enter the 1st line of the cheque to deposit (exit to quit): Fred's Pennies $***0.01 Enter the 2nd line of the cheque: 01/100************************************************* Numeric amount and word amount match! Cheque amount deposited is $0.01 Enter the 1st line of the next cheque to deposit (exit to quit): BigLots $***999.89 Enter the 2nd line of the cheque: Nine Hundred and Ninety Nine 89/100****** Numeric amount and word amount match! Cheque amount deposited is $999.89 Enter the 1st line of the next cheque to deposit lexit to quit): Palm Desert Resort Golf $***35.38 Enter the 2nd line of the cheque: Thirty-Five 38/100************************************* Numeric amount and word amount match! Cheque amount deposited is $35.38 Enter the 1st line of the next cheque to deposit (exit to quit): Jake's Sushi Palace $***15.00 Enter the 2nd line of the cheque: Fifteen xx/100 Numeric amount and word amount match! Cheque amount deposited is $15.00 Enter the 1st line of the next cheque to deposit (exit to quit): Worldwater Park $****60.23 Enter the 2nd line of the cheque: Sixty and 23/100 Numeric amount and word amount match! Cheque amount deposited is $60.23 Enter the 1st line of the next cheque to deposit (exit to quit): The Big Apple $*****213.55 Enter the 2nd line of the cheque: Two Thirteen Hundred 55/100***** ERROR: numeric amount and word amount DON'T MATCH. Auto Deposit rejected. Enter the 1st line of the next cheque to deposit (exit to quit): ATV Adventures Enter the 2nd line of the cheque: Five Hundred Four Hundred Ten 00/100 ERROR: numeric amount and word amount DON'T MATCH. Auto Deposit rejected. Enter the 1st line of the next cheque to deposit (exit to quit): Joshua Climbing Adventures $***895.00 Enter the 2nd line of the cheque: Eight Hundred ERROR: numeric amount and word amount DON'T MATCH. Auto Deposit rejected. Enter the 1st line of the next cheque to deposit (exit to quit): exitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started