Write a main program that creates a queue size of 5

Assignment Help Computer Engineering
Reference no: EM132171528

Using the language RUBY

Create a RUBY class QUEUE that inplements methods enqueue, dequeue, and show, Instance variables are

size - size of array that implements queue

q - array that represents queue (fixed size)

inp- index that specifies that an input value that is going in th queue should be stored in q[inp]

out- index that specifies that an output value that is leaving the queue should be taken from q[out]

empty- a logic flag which is true if the queue is empty (no elements)

full- logic flag which is true, if the que is full and has no free space for new elements.

The method q.enqueue(x) should store the value x in the queue q. The method x = q.dequeue should take the appropriate value from the queue q and store it in the vriable x.

The method q.show should display the FIFO queue in the form <1|2|3|4|5 where 5 is the last element stored.

Write a main program that creates a queue size of 5 and uses a loop to crrate the out put shown here.

<empty queue>

<0|

<0|1|2|

<0|1|2|3|

<0|1|2|3|4|

Reference no: EM132171528

Questions Cloud

Create a custom banner : Create a custom banner that displays the following information when you log into your normal user's shell.
Find the current ratio and acid-test ratio : Turbo Start has current assets totaling $1.5 million (this includes $500,000 in current inventory) and current liabilities totaling $50,000.
Metrics are powerful tool to assess progress and setbacks : Project metrics are fundamental to project risk management. Metrics are a powerful tool to assess progress and setbacks.
What is the total yearly business expense : Scarmack's Paint Company has annual sales of $500,000 per year. If there is a profit of $1000 per day, 6 days per week operation.
Write a main program that creates a queue size of 5 : Write a main program that creates a queue size of 5 and uses a loop to crrate the out put shown here.
Aware of unethical behavior happening at workplaces : How can top management make sure to be aware of unethical behavior happening at a workplaces.?
How is organization different from an individual : How is an "organization" different from an individual? Why did Allison develop these three Models of decision making - why not just one?
Compute the predetermined indirect cost application rate : RLW-II Enterprises estimated that indirect manufacturing costs for the year would be $60 million and that 12,000 machine-hours would be used.
What financial statements are required to be prepared by tax : Assuming 4% of the gross tax levy will be uncollectible, What financial statements are required to be prepared by the tax agency fund

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd