Welcome to Bar Code Generator Enter Zip Code (exit to quit): 19104 Bar Code: Enter Zip Code (exit to quit): 19128 Bar Code: Enter Zip Code (exit to quit): 07004 Bar Code: Enter Zip Code (exit to quit): exit Thanks using me.

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter7: Developing An Excel Application
Section: Chapter Questions
Problem 3.6CP
icon
Related questions
Question

Write a program that coverts a zip code to a bar code.

The bar codes use large and small bars. We will use : as a small bar and | as a large bar.

Each digit has its own bar pattern.

  • 1 is :::||
  • 2 is ::|:|
  • 3 is ::||:
  • 4 is :|::|
  • 5 is :|:|:
  • 6 is :||::
  • 7 is |:::|
  • 8 is |::|:
  • 9 is |:|::
  • 0 is ||:::

The barcode also includes a check digit. The final digit added to the bar code verifies the previous numbers are correct.

To Determine the checksum:

  • Add all the digits together
  • Determine what needs to be added to make the total a multiple of 10

The bar code also always starts and ends with a large bar. This is used by the scanner to align the letter.

Drexel's Zip Code is 19104

The check digit is 5. The sum of the digits is 1+9+1+0+4 = 15. To make 15 a multiple of 10, we need to add 5.

The bar code will be |:::|||:|:::::||||::::|::|:|:|:|

The majority of work in this problem is done by digit. It makes sense to store the zip code as a string, not as an integer.

Write the function checksum(zip) that takes the zip code as a string and returns the check digit as a string.

Write a function barcode(zip) that takes a zip code as a string and returns the bar code.

Develop a main program that repeatedly asks the user for zip codes and converts them to bar codes. The program will run until the user enters "exit". Remember to use if name=="main": so that ZyBooks can test your functions.

This code is for python
Welcome to Bar Code Generator
Enter Zip Code (exit to quit):
19104
Bar Code:
Enter Zip Code (exit to quit):
19128
Bar Code:
Enter Zip Code (exit to quit):
07004
Bar Code:
Enter Zip Code (exit to quit):
exit
Thanks using me.
Transcribed Image Text:Welcome to Bar Code Generator Enter Zip Code (exit to quit): 19104 Bar Code: Enter Zip Code (exit to quit): 19128 Bar Code: Enter Zip Code (exit to quit): 07004 Bar Code: Enter Zip Code (exit to quit): exit Thanks using me.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L