Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal of this assignment is to write a program that handles values of type string and performs character I/O, by the member function get

image text in transcribed
The goal of this assignment is to write a program that handles values of type string and performs character I/O, by the member function get described in Section 6.3 of the textbook. Write a C++ program that prompts the user to enter a zip code, converts that zip code to a bar code representation described below, and displays the resulting bar code. Zip Codes: The user may enter a zip code in one of the following three acceptable zip code formats: Short: A 5-digit zip code, such as 67218. Medium: A hyphen and a 4-digit extension are appended to the short zip code to produce the medium version, such as 67218-1234. Long: A plus sign and the last two digits of the street address or box number are appended to the medium zip code to get the long version, such as 67218-1234+12. Checksum Digit: This is a unique digit (between 0 and 9). which when added to the sum of all the other digits in the zip code, will make the sum a multiple of 10. For example, if the zip code is 67218, then 6 + 7 + 2 + 1 + 8 = 24, so the checksum digit must be 6. As another example, if the zip code is 67218-1234+12, then 6 + 7- 2+ 1+ 8+ 1+2 + 3 4 + 1+ 2=37, so checksum digit is 3. The usage of the checksum digit to obtain the bar code is explained below. Bar Codes: The format for a bar code is: I Z E D C I where: I is a vertical bar character, Z is the 5-digit encoded short bar code (for all zip codes), E is the optional 4-digit encoded bar code extension (for medium and long zip codes only). D is the optional encoded 2-digil delivery point (for long zip codes only), C is the encoded checksum digit (for all zip codes). Encodings of digits employ two bars: the short one "." and a tall one "I", as follow s: 1 = ... I I 2 = .. I.I 3 = .. II 4 = .I .. I 5 =. I. I. 6 =. II .. 7 = I ...I 8 = I..I. 9 = I.I.. 0 =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago