Question: Please help me with this C++ lab example. I will provide the given codes below the pictured instructions. thank you so much ------------------------------------------------------------------------------------------------------------------------- // main.cpp
Please help me with this C++ lab example. I will provide the given codes below the pictured instructions. thank you so much


-------------------------------------------------------------------------------------------------------------------------
// main.cpp
#include
#include
#include "ZipCode.h"
using namespace std;
int main()
{
ZipCode zip1(99504);
ZipCode zip2(12345);
ZipCode zip3(67890);
ZipCode zip4("100101010011100001100110001");
ZipCode zip5("110100001011100001100010011");
ZipCode zip6("100011000110101000011100101");
cout
cout
cout
cout
cout
cout
cout
cout
return 0;
}
nstructors Lab (Bar Codes) Cons 2009 the bar code on the envelope used by the U.S. Postal Service Prior to 2009 the bar Prior tted a five (or more) digit zip code using a format called POSTNET. The represete consists of long and short bars as shown below: esen bar code congn Illnhlub For this this program we will represent the bar code as a string of digits. The digit 1 nts a long bar, and the digit 0 represents a short bar. Therefore, the bar shown above would be represented in our program as: represents a l code 11010010100010101 1000010011 The first and last digits of the bar code are always 1. Removing these leave 25 digits. If these 25 digits are split into groups of five digits each then we have: 10100 10100 01010 11000 01001 Next, consider each group of five digits. There will always be exactly two 1's in each group of digits. Each digit stands for a number. From left to right the digits encode the values 7, 4, 2, 1, and 0. Multiply the corresponding value with the digit and compute the sum to get the final encoded digit for the zip code. The table below shows the encoding for 10100. Bar Code Digits Value 7 4 2 10 1010 Product of Digit x Value 7 0 12 Zip Code Digit = 7 + 0 + 2 + 0+0=9 o get the complete zip Repeat this for each group of five digits an code. Note that there 11, then this represible to repr te that there is one special value. If the sum of a group of five digits is this represents the digit 0 (this is necessary because with two 1's pe s not possible to represent zero). The zip code for the sample bar code d concatenate t Page 225 group it is not Focus on on Object-Oriented Programming with C++
Step by Step Solution
There are 3 Steps involved in it
To complete this assignment youll need to create a ZipCode class with appropriate constructors membe... View full answer
Get step-by-step solutions from verified subject matter experts
