Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Background: The following tables show the costs associated with a certain produc

ID: 3798177 • Letter: B

Question

Background: The following tables show the costs associated with a certain product and the production volume for the four quarters of the business year. You are provided .csv data to load representing the non-shaded areas in the tables below. The tables are provided to help you understand the data you are provided The goal of this program is to determine the following: The highest costing quarter (combine all 5 products) and the associated Total Material, Labor, Transportation, and overall cost. The highest costing product for the year and the associated Material, Labor, Transportation, and Total cost for that product. Include required documentation and header for the problem The output of your program should look like the test case displayed below with the same spacing indentations, and number of significant digits.

Explanation / Answer

cost = csvread('file1.csv');
[rc, cc] = size (cost);
volume = csvread('file2.csv');
[rv, cv] = size (volume);

if cc~=3 || cv~=4 || rc~=rv
    disp("FORMAT MISMATCH");
    return
end


maxQuater = 0;
maxQuaterValues = zeros(1,cc);

for i = 1:4 %for each quater
    temp = 0;
    tempValues = zeros(1,cc);
    for j = 1:rc %for each product
        for k = 1:cc %for each sub-cost
            temp = temp + volume(j,i)*cost(j,k);
            tempValues(1,k) = tempValues(1,k) + volume(j,i)*cost(j,k);
        end
    end
    if temp > sum(maxQuaterValues)
        maxQuaterValues = tempValues;
        maxQuater = i;
    end
end

printf(" Max costing quater is %d Total cost of quater: ",maxQuater);

printf("Material: %d Labour: %d Transportation: %d ",maxQuaterValues(1,1),maxQuaterValues(1,2),maxQuaterValues(1,3));


maxCostProduct = 0;
maxCost = zeros(1,cc);

for i=1:rc %for each product
    tempCost = zeros(1,cc);
    for j=1:4 %for each quater
        for k=1:cc %for each subcost
            tempCost(1,k) = tempCost(1,k) + volume(i,j)*cost(i,k);
        end
    end
    if sum(tempCost) > sum(maxCost)
        maxCostProduct = i;
        maxCost = tempCost;
    end
end


printf(" Max costing product is %d Total cost of quater: ",maxCostProduct);

printf("Material: %d Labour: %d Transportation: %d ",maxCost(1,1),maxCost(1,2),maxCost(1,3));

NOTE:

file1.csv contains matrix cost

file2.csc contains matrix volume