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

  Write a program that prints all powers of two

Write a program that prints all powers of 2 from 20 up to 220. Write a program that reads a number and prints all of its binary digits.

  Question1 write down an application named coins that asks

question1. write down an application named coins that asks user to enter one integer representing a monetary value in

  Analyse how data warehouses and data marts differ

Analyse how data warehouses and data marts differ. Explain 2-3 practical applications for each of them and justify your reasoning.

  Write codes to implement the given expression

COA Assignment Task - Write codes to implement the expression: A= (B + C * D - E) on 3-, 2-, 1- and 0-address machines

  Find out and display the total owed for all taxpayers

A taxpayer's federal tax due is calculated as follow. First, the taxpayer gets a dependency exemption deduction of $2,000 for each child. So, if a taxpayer has two children, he or she would get a dependency exemption deduction of $4,000. A taxpaye..

  Define how does internet change information systems

The Internet may not make corporations obsolete, but they will have to change their business models

  What difference between private type or limited private type

What is the difference between these two? Is there a similar concept in C++? If not, why not? Does their absence imply a lack of functionality in C++?

  Merging using this process

Merging is the mehood of combining two sorted lists into a single sorted list. In some cases, one list can be appended to the other, and the new list then can be sorted. Merging using this method, though, is not always the most efficient.

  Write a function that takes as input two arguments

Write a function (caesar.m) that takes as input two arguments: a string to encrypt and the key (shift value), and outputs a single argument.

  Implement the vertex cover problem

Implement the Vertex Cover problem; that is, given graph G and integer k, answer the question of whether or not there is a vertex cover of size k or less.

  Explain the agile unified process

Compare and contrast agile unified process and the process groups outlined in Project Management Body of Knowledge (PMBOK).

  Write a complete program that demonstrates the functions

Write a function named arrayToFile. The function should accept three arguments: the name of a file, a pointer to an int array, and the size of the array.

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