Copy the main function below and continue to implement the program. Write a zip
ID: 3790587 • Letter: C
Question
Copy the main function below and continue to implement the program. Write a zip code class that encodes and decodes five digit bar codes used by the US Postal Service on envelopes. The class should have two constructors. The first constructor should input the zip code as an integer and the second constructor should input the zip code as a bar code string consisting of 0’s and 1’s as described above. Although you have two ways to input the zip code, internally the class should only store the zip code using one format (you may choose to store it as a bar code string or as a zip code number.) The class should also have at least two public member functions, one to return the zip code as an integer, and the other to return the zip code in bar code format as a string (please use names as suggested by the main program). All helper functions should be declared private. Also, your code should do error checking, as suggested in the main program and output below. Your class definition and member functions should work with the given main function to generate right results (please don’t change anything in the main function). Hint: you may use an array to represent the barcode, or you may use the string class. We haven’t learned string class formally, but here is some information to use the basics of it. • Include the library • Declare a string object: string aString; • Add one character, e.g., ‘a’ to the current string aString += ‘a’; • Get string’s length, aString.length(); • Access a certain character in a string aString[i], i is the index number.
All of the other answeres weren't helpful, I'll give a good rating for the most helpful response. Thanks.
MAIN FILE:
Output Example 99504 's bar code is 11010010100010101 1000010011 24060's bar code is 10010101001110000 1100110001 12345' s bar code is 10001100101001100 1001010101 67890's bar code is 101100100011001010100110001 0 has code 1110001100011000 11000 110001 [0K1 2 54289 has code 101010010010010110010100 1001 [0Kl 3: 19024 has code 10001110100 1100000101010001 ERR] 4: 99849 has code 11010010100 100100 1001 100 1001 [0Kl 5 83600 has code 1100100011001100 11000 110001 [0K] 6 80625 has code 110010110000110000101010101 [0Kl 7: 99396 has code 1101001010000110101000 1001 [0Kl 8 12609 has code 1000110010101100 11000 101001 [0Kl 9 41924 has code 101001000111010000101010011 [0K] 10: 98641 has code 11010010010011000 1001000111 [0Kl 11 41316 has code 1010010001100110000011011001 [0Kl 12 2921 has code 111000001011010000101000111 [0K] 13 97584 has code 110100100010101010010010011 [0Kl 14 69721 has code 10110010100 1000100101000111 [0Kl 15 63616 has code 1011000011001 10000011011001 [0Kl 16 96225 has code 110100011000010100101010101 [0Kl 17 97824 has code 110100100011001000101010011 [0Kl 18 24009 has code 100101010011100011000 100 1001 [0K] 19 94564 has code 11010001001010100 1100010011 [0Kl 20: 25625 has code 100101010100110000101010101 [0Kl 21 84100 has code 110010010010001111000 110001 [0Kl 22: 92601 has code 1101000010101100 11000000111 [0Kl 23 53124 has code 1010100011000011001010 10011 [0Kl 24 43889 has code 101001001101001010010100 1001 [0Kj 25 90336 has code 1101001100000110001100 1001 [0Kl Testing: bad start/end character 10010101001110000 1100 1100000 Wrong start/end character in the barcode! Testing: bad digit 1001010100111 00001100110021 Wrong barcode A barcode can only contain '0' and '1' Enter a character to quitExplanation / Answer
#include int main(int argc, char * argv[]) { ZipCode zip(99504), zip2("100101010011100001100110001"), zip3(12345), zip4(67890); coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.