Question
generateBarcode(...) *Precondition: The input String is not null. *Post condition: the returned string is exactly 12 characters in length where each character is a digit
generateBarcode(...)
*Precondition: The input String is not null.
*Post condition: the returned string is exactly 12 characters in length where each character is a digit [0-9]. The string should be constructed using the following rules:
-All characters in the string will be converted to numbers [0-26] e.g. 'A' or 'a' =1, 'Z' or 'z' =26. All the other character that are not letters =0.
-Groups of 3 consecutive characters numbers will be added together to form a new number; this value will be converted to a String of two digits(pad with a 0 in front of necessary)
-The next group of 3 this is to be done to is two characters later, and so on until 12 total characters have been made. This represents the barcode (If there are not enough character numbers to do this assume 0.
This is for Java
generateBarcode Example: String Character 165 9 14 5 0 19 15 12 0 0 0 39 34 00 Added Groups: Added Groups: 19 27 Final Barcode String: 391934270000Step 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