Display the result of a boolean comparison

Assignment Help Basic Computer Science
Reference no: EM131396248

The Universal Product Code (UPC) on most grocery items contains a zero that is printed to the left of the bar code and 10 digits that are printed in two groups of five each below the code. The first five digits represent a manufacturer and the second five digits represent a specific product. To the right of the bar code, a check digit is printed. Write a program that allows the user to enter the five-digit manufacturer code, the five-digit product code, and the check digit. Display the result of a Boolean comparison (0 or 1) that shows whether the check digit is correct according to the following algorithm

a. Sum the second and fourth numbers in the manufacturer code.

b. Sum the first, third, and fifth numbers in the product code.

c. Sum the results of step a and step b, and multiply the total by 3.

d. Sum the first, third, and fifth numbers in the manufacturer code.

e. Sum the second and fourth digits in the product code.

f. Sum the results of steps d and e and add to the result from step c.

g. Take the remainder when the result of step f is divided by 10.

h. Subtract the result of step g from 10. Compare this result to the check digit entered by the user. If the result and check digit are equal (if the Boolean value of the comparison is 1), then the UPC is a valid one.

Save the file as UPC.cpp. After you write the program, test it using UPC values from several grocery items from your home. (Make sure the digit to the left of the bar code is 0- the 0 indicates that the code follows this algorithm.)

Reference no: EM131396248

Questions Cloud

What will happen to the equilibrium price : An unusually cold winter will mean consumers will demand more wool sweaters. What will happen to the demand curve? What will happen to the supply curve? What will happen to the equilibrium price? What will happen to the quantity sold?
Should athletes be allowed to use performance-enhancing drug : PHI103:Construct an argument for a position on the topic. This is the position that you will defend in your Final Paper. Make your argument as high quality as possible: In particular, make sure that all of your premises are true and that the truth..
What parts of the data was most interesting to you : What parts of the data was most interesting to you? Which occupations? Which occupations might require more than just a BS degree? Did any of the data surprise you or strike you as odd?
Restructured medicaid to control expenditures : Discuss how states have restructured Medicaid to control expenditures as well as options presented, but not approved to the federal government to restructure Medicaid.
Display the result of a boolean comparison : Save the file as UPC.cpp. After you write the program, test it using UPC values from several grocery items from your home. (Make sure the digit to the left of the bar code is 0- the 0 indicates that the code follows this algorithm.)
Criticize the given definitions - ipod : Criticize the following definitions in light of the eight rules for lexical definitions:- "iPod" means a handheld electronic device having a single click-wheel on one side.
Preferred by recipients over in-kind transfers : 1. Why would cash transfers typically be preferred by recipients over in-kind transfers? What are the pros and cons of each from a government perspective?
Criticize the given definitions - a theist : Criticize the following definitions in light of the eight rules for lexical definitions:- A theist is anyone who is not an atheist or an agnostic.
Write a program that allows the user to enter two values : Write a program that allows the user to enter two values. Display the results of adding the two values, subtracting them from each other, multiplying them, and dividing them. Save the file as MathExercise.cpp.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd