Ask Question
3 March, 11:32

A machine cuts N pieces of a pipe. After each cut, each piece of pipe is weighed and its length is measured; these two values are then stored in a matrix with two columns (first the weight and then the length on each row of the matrix). Ignoring units, the weight is supposed to be between 2.1 and 2.3, inclusive, and the length is supposed to be between 10.3 and 10.4, inclusive. Write a script that counts how many rejects there are. A reject is any pipe that has an invalid weight and/or length. For a simple example, if N is 3, the matrix could look like: a. 2.14 b. 10.30 c. 2.32 d. 10.36 e. 2.20 f. 10.45

+4
Answers (1)
  1. 3 March, 12:42
    0
    weight = [2.14 2.32 2.20 2.12 2.25 2.19]

    length = [10.30 10.36 10.35 10.39 10.41 10.25]

    numRejects = 0;

    for k = 1:size (weight)

    if weight (k) 10.3

    numRejects = numRejects + 1

    end

    end
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A machine cuts N pieces of a pipe. After each cut, each piece of pipe is weighed and its length is measured; these two values are then ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers