subject
Computers and Technology, 11.11.2020 18:00 mia2286

Retail products are identified by their Universal Product Codes (UPCs). The most commonform of a UPC has 12 decimal digits: The first digit identifies the product category, the nextfive digits identify the manufacturer, the following five identify the particular product, andthe last digit is acheck digit. The check digit is determined in the following way: • Beginning with the first digit multiply every second digit by 3.
• Sum all the multiplied digits and the rest of the digits except the last digit.
• If the (10 - sum % 10) is equal to the last digit, then the product code is valid.
• Otherwise it is not a valid UPC. The expression is:sum= 3.x1+x2+ 3.x3+x4+ 3.x5+x6+ 3.x7+x8+ 3.x9+x10+ 3.x11where the x’s are the first 11 digits of the code.
If you choose to add the last digit also in the second step and if the sum is a multiple of 10,then the UPC is valid. Either way, you still need to perform the modular division to checkwhether the given number is a valid code. In this problem, you need to use either a string or long long integer type for the product codebecause it is 12 digits long. If you use string, you can convert one character substring of thestring in to a single digit integer from left to right using the function stoi(str. substr(i,1)).This way you do not need to get last digit of the number and then divide the number by 10.
in c++
problem 3
Translate the following pseudocode for randomly permuting the characters in a string into a C++ program. Read a word. repeat word. length() times Pick a random position i in the word, but not the last position. Pick a random position j > i in the word. swap the letters at positions j and i. Print the word. Please work on this problem after we learn to generate random numbers in the class which is on Wednesday the latest. These problems only deal with simple loop while, for and do loops. You will get a second set of problems next week on nested loops.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 10:50
The volume v and paper surface area a of a conical paper cup are given by where r is the radius of the base of the cone and h is the height of the cone. a. by eliminating h, obtain the expression for a as a function of r and v. b. create a user-de ned function that accepts r as the only argument and computes a for a given value of v. declare v to be global within the function. c. for v ! 10 in.3 , use the function with the fminbnd function to compute the value of r that minimizes the area a. what is the corresponding value of the height h? investigate the sensitivity of the solution by plotting v versus r. how much can r vary about its optimal value before the area increases 10 percent above its minimum value?
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
Answer these and get 40 points and brainliest
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
Cómo pongo un tomo de llamada sin pagar?
Answers: 1
question
Computers and Technology, 24.06.2019 14:40
Create a function (prob3_6) that will do the following: input a positive scalar integer x. if x is odd, multiply it by 3 and add 1. if the given x is even, divide it by 2. repeat this rule on the new value until you get 1, if ever. your program will output how many operations it had to perform to get to 1 and the largest number along the way. for example, start with the number 3: because 3 is odd, we multiply by 3 and add 1 giving us 10. 10 is even so we divide it by 2, giving us 5. 5 is odd so we multiply by 3 and add one, giving us 16. we divide 16 (even) by two giving 8. we divide 8 (even) by two giving 4. we divide 4 (even) by two giving 2. we divide 2 (even) by 2 to give us 1. once we have one, we stop. this example took seven operations to get to one. the largest number we had along the way was 16. every value of n that anyone has ever checked eventually leads to 1, but it is an open mathematical problem (known as the collatz conjectureopens in new tab) whether every value of n eventually leads to 1. your program should include a while loop and an if-statement.
Answers: 3
You know the right answer?
Retail products are identified by their Universal Product Codes (UPCs). The most commonform of a UPC...
Questions
question
Physics, 19.10.2019 11:30
question
History, 19.10.2019 11:30
question
Mathematics, 19.10.2019 11:30
question
Mathematics, 19.10.2019 11:30
question
Mathematics, 19.10.2019 11:30
question
Mathematics, 19.10.2019 11:30
Questions on the website: 13722360