Mips assembly language programming I have to write a program

Mips assembly language programming

I have to write a program in mips that goes as follows:

The CTO of an important chain of supermarkets asks you to write a program in Assembly that optimizes customers’ queues at the cashier for checkout. There are three cashiers, thus three lines: without any control, currently these lines fill in very unevenly. The goal is to make them uniform, by directing incoming customers to lines having less people lined up… There are three lines A, B, C, each capable of holding up to 5 customers, that can be seen algorithmically as three Queues: enter (‘I’, meaning In) from the end, exit (‘O’, meaning Out) from the head. Incoming customers are a ‘I’, checked out customers are a ‘O’. Let’s see the working principle of your algorithm with examples… General principle: when enqueuing a new customer, always go for the line (queue) holding the lowest number of customers in line, starting to scan from line A, then B, then C.

Lines empty:

A:

B:

C:

A new customer comes in (‘I’):

A: +

B:

C:

A new customer comes in (‘I’):

A: +

B: +

C:

A new customer comes in (‘I’):

A: +

B: +

C: +

A new customer comes in (‘I’): place it in the line with lowest amount of customers, start from line A to verify such condition:

A: + +

B: +

C: +

At some point, for example you have a situation like the following:

A: + + +

B: + +

C: + +

A new customer is checked out (‘O B’):

A: + + +

B: +

C: + +

At some point, for example if you have a situation like the following…

A: + + + + +

B: + + + + +

C: + + + + +

..and you get a new customer (‘I’), display an error message “ALL LINES FULL: TRY LATER!”

A: + + + + +

B: + + + + +

C: + + + + +

(note that in this case check out, for example a ‘O A’, is the only way to proceed)

At some point, for example you have a situation like the following:

A: + + +

B: +

C: + +

A new customer comes in (‘I’):

A: + + +

B: + +

C: + +

Solution

logic

take three array a[5] , b[5] , c[5]

int i=0,j=0,k=0;

if i=j=k so insert first in a array priority

if person inserted in a

i++ // now i became i

if condition(i<=5 &&j<=5&&k<=5) max no more person can be inserted

if a person want to move out

select from which queue ( or array want to move out)

for eg b array person wnt to move out

j--; after person move out

person will move to the lowest queue

check i or j or k which is smallest

and if all same so

move to i ( give starting priority)

Mips assembly language programming I have to write a program in mips that goes as follows: The CTO of an important chain of supermarkets asks you to write a pro
Mips assembly language programming I have to write a program in mips that goes as follows: The CTO of an important chain of supermarkets asks you to write a pro
Mips assembly language programming I have to write a program in mips that goes as follows: The CTO of an important chain of supermarkets asks you to write a pro

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site