Answer to Question #241702 in Programming & Computer Science for knight_manakal

Question #241702

The "SUPER GOODS " Pvt. Ltd. manufactures spices for the export market. In the factory, there are two machines called A and B. The following table shows a sample production of each machine in seven days. Day1 Day2 Day3 Day4 Day5 Day6 Day 7 Production of Machine A 160 180 150 110 190 140 165 Production of Machine B 180 100 115 170 155 165 195

Write a program in pseudocode to

• Declare a two-dimensional array to store these data and get user input to load the array. • Find the total production of machine A in the entire week. • Display the highest production and name of the machine that produced it.


1
Expert's answer
2021-09-24T11:25:57-0400
Start
	Declare array dataAB[][7]={{160,180,150,110,190,140,165},{180,100,115,170,155,165,195}}
	Set totalProduction to 0
	for i=0 to 7
		totalProduction=totalProduction+dataAB[0][i]
	end for
	Display "The total production of machine A in the entire week: "+totalProduction+"\n"
	Set highestProduction to dataAB[0][0]
	Set indexI to 0
	Set indexJ to 0
	for i=0 to 2
		for j=0 to 7
			if highestProduction<dataAB[i][j] then
				Set highestProduction to dataAB[i][j]
				Set indexI to i
				Set indexJ to j
			end if
		end for
	end for
	Set nameMachine to "A"
	if indexI=1 then
		Set nameMachine to "B"
	end if
	Display "The highest production is: "+dataAB[indexI][indexJ]+" the name of the machine that produced it is: "+nameMachine
Stop

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS