Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.)

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92206063

Have any Question?


Related Questions in Computer Engineering

Configuring name resolutionas the administrator of the

Configuring Name Resolution As the administrator of the Contoso Corporation, you manage an internal website that is often used by most users with the company. You try to connect to an internal website but cannot open the ...

With more persons working from home how does one separate

With more persons working from home, how does one separate data intended for the employer form what might be considered personal property? What policies could be put in place to ensure employees adhere to safe guidelines ...

Sally goes into a candy store and selects 12 pieces of

Sally goes into a candy store and selects 12 pieces of taffy. The candy store offers 75 varieties of taffy. How many ways are there for Sally to select her 12 pieces of taffy?

A researcher conducts a well-designed study to compare a

A researcher conducts a well-designed study to compare a sample mean to a known population mean and uses alpha=.05, two-tailed. She finds a z-test of 1.98, p-value=.048. What should she conclude? a. The 95% confidence in ...

Patient patientid familyname givenname address suburb state

PATIENT (PatientID, FamilyName, GivenName, Address, Suburb, State, PostCode) DOCTOR (ProviderNo, Name) ITEM (ItemNo, Description, Fee) ACCOUNT (AccountNo, ProviderNo, PatientID, TreatmentDate) ACCOUNTLINE (AccountNo, Ite ...

University bookstores order books that instructors adopt

University bookstores order books that instructors adopt for the courses. The number of copies order matches the projected the demand. However, at the end of the semester the bookstore has too many copies on hand and mus ...

Objectiveto apply object-oriented methodology for analysis

Objective To apply object-oriented methodology for analysis of information systems development in a case study. Case Study -Chemist ServiceGroup Chemist Service group is a chainof chemiststores. It employs more than8,000 ...

There is a small company which in some months maintains an

There is a small company which in some months maintains an office in Aukland (code A) and in others in Brisbane (code B), and moves back and forth between these two cities (they can only afford to have one office operati ...

What are security planning principles what is policy-based

What are Security Planning Principles? What is policy-based security? (Hint for both: pure definition is not good enough. Answers need to be illustrated in the context of an example or scenario).

Question suppose you want to achieve a speedup of 90 times

Question : Suppose you want to achieve a speedup of 90 times faster with 100 processors. What percentage of the original computation can be sequential? Assume one byte data value is 1101, 1000(binary). When we decode the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As