Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I needto get thi programming in C. Postal Codes: 50 Points The US Postal Service uses bar codes that can be quickly read to route

I needto get thi programming in C. Postal Codes: 50 Points The US Postal Service uses bar codes that can be quickly read to route postal mail. The bar code encodes the zip code the letter is being sent to. Each digit is given it's own 5 digit symbol made up of short and long lines. We will use . for short lines and | for long lines. The number to bar code relation is shown below. Digit Code 1 ...|| 2 ..|.| 3 ..||. 4 .|..| 5 .|.|. 6 .||.. 7 |...| 8 |..|. 9 |.|.. 0 ||... In addition to the digits of the zip code, a checksum is also included in the bar code. This is a special digit that can be used to detect errors. We want to make the bar code for Drexel University at 19104. We have the five digits but we need the checksum. To make it we add the digits of the zip code together. 1+9+1+0+4 = 15 Next, we need to answer the question what needs to be added to this sum to reach the next multiple of ten? We need to add 5 because 15+5=20. If the sum of the digits was already a multiple of ten then we would add 0. We have our 5 digits 19104 and our check digit 5. The bar code always starts and ends with a | for scanner alignment. the bar code for this zip code is shown below. |...|||.|.....||||....|..|.|.|.| You will write a program in C that will ask the user for a 5 digit zip code. It will then print out the bar code. If you are not given exactly 5 digits, print the error "Bad Zip Code" and return 1. Note that some zip codes in the US start with 0! Here are some examples: Example 1 Enter Zip Code: 19104 |...|||.|.....||||....|..|.|.|.| Example 2 Enter Zip Code: 12345 |...||..|.|..||..|..|.|.|..|.|.| Example 3 Enter Zip Code: 67890 |.||..|...||..|.|.|..||...||...| Example 4 Enter Zip Code: 08084 |||...|..|.||...|..|..|..|||...| Example 5 Enter Zip Code: 1234 Bad Zip Code

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago