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(...) *Precondition: The input String is not null. *Post condition: the returned

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: 391934270000

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 Databases Questions!