1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Roman55 [17]
3 years ago
8

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.
Computers and Technology
1 answer:
Dahasolnce [82]3 years ago
8 0

Answer:

#include <iostream>

#include <cmath>

using namespace std;

int main(){

   string upc;

   char last;

   cout<< "Enter UPC number: ";

   cin >> upc;

   if (upc.size() == 12){

       last = upc[-1];

   } else{

       return 0;

   }

   cout<< last;

   char myArr[upc.length()];

   for (int i = 0 ; i < upc.substr(0,11).length(); ++i){

       if (upc[i]%2 != 0){

           myArr[i] = upc[i] * 3;

       }

       else{

           myArr[i] = upc[i];

       }

   }

   int sum = 0;

   for (int x = 0; x < sizeof(myArr); ++x){

       sum += (int)myArr[x] - '0';

   }

   if (sum% 10 == last){

       cout<<"UPC number is valid";

   }

   else{

       cout<<"Invalid UPC number.";

   }

}

Explanation:

The UPC number in the c++ source code input must be 12 digits long for the rest of the code to execute.  The code checks the validity of the number by comparing the reminder of the sum division with the last digit in the UPC number.

You might be interested in
What how do i delete a question
Dvinal [7]

Answer: not sure if you can

Explanation: idk if you can but if you wanna get a good answer try searching up on google hope i helped!

7 0
3 years ago
40 POINTS I NEED THESE ANSWERS ASAP GIVE ME THE RIGHT ASNWER AND ILL PUT YOU AS THE BRAINLIEST
Law Incorporation [45]
Having a filling system and keeping a clean desk is good time management tips (True)

Your wrists should be low,relaxed and resting on the frame of the keyboard while typing (False)

A correctly formatted memo will have a complimentary closing? (False)

Which professional business memo part is keyed first?
D.) TO

to type a capital letter "T" the typist will hold the right shift key with the right little finger, and then strike "t" with the left pointer (first) finger. (True)

in a standard block style letter, key the date to print ___ from the top edge of the page
D.) Double space (DS)

A search engine can help link you to information on how to format a buisness letter. (True)
7 0
3 years ago
Which of the following relate to the term Technology?
sp2606 [1]

Answer:

the answer is D.All of the above

7 0
3 years ago
Read 2 more answers
What changes have occurred over the last 25 years impacting how we use information systems and that increasingly require using e
Elden [556K]

Answer:

Follows are the solution to this question:

Explanation:

Throughout the presence of third-party companies that is attackers, cryptography is indeed a method of protecting information and communication.

Its cryptographic techniques are numerous, which are used for data security and encryption levels were defines, throughout all protocols.

Encryption - was its method for encoding a message and information. So, it can be viewed only by authorized parties.

They can search online for various data encryption. The changes over the last 25 years also actually occurred:

Cryptography is all around. Each time you make a phone call, buy something like that in a store or even on the Internet with a credit or debit card or receive money from an Atm is an authentication that helps secure and secures the payment.

Tausend years ago, codes or encryption were used to protect information. These encryption schemes have evolved from the past 25 years or say we are getting far better than that of the preceding one But cryptography was far more advanced with both the advent of computers than it used to be.

World War II would also see Enigma code, the perfect example of analog encryption.

Its computer design technology had also finally been enough to break its Enigma cipher, as well as Enigma texts, still are regarded as just a necessary component of the probable Affiliated successes.

Mathematical 128-bit cryptography has become a standard for several sensible computers and portable structures, far greater than every prehistoric or ancient plasterboard.

Without it.

AES - Another of our safest cryptography techniques is the Intensive Encryption System. The state-government uses it to protect classified information, that is used by all of our phones.

6 0
3 years ago
Select the correct answer.
DochEvi [55]

Answer:

ask customers to use strong passwords to protect their accounts

6 0
3 years ago
Read 2 more answers
Other questions:
  • The numbers on the bottom of a typical check represent all of the following EXCEPT?
    12·2 answers
  • Pretrial services programs are also known as early intervention programs. <br> a. True <br> b. False
    15·1 answer
  • Which of the following functions does a browser perform?
    7·2 answers
  • Programming challenge description: Write a program that, given two binary numbers represented as strings, prints their sum in bi
    6·1 answer
  • Which type of RAM is used exclusively in laptops?<br> a) SODIMM<br> b) DDR3<br> c) DDR<br> d) DDR4
    15·1 answer
  • Which 1898 film did George Melies create using camera trickery to create a illusion in which we now
    11·1 answer
  • Explain the<br>4 ways<br><br>ways of arranging icons.<br><br>​
    6·1 answer
  • I really want to know the best way to deal as much heart as possible plz tell me
    7·2 answers
  • People often want to save money for a future purchase. You are writing a program to determine how much to save each week given t
    11·2 answers
  • What is the difference between second generation and third generation of computer​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!