Rewrite the code of Figure 7.3 in Ada, Java, or C#. Figure 7.3: template class queue {
Question:
Rewrite the code of Figure 7.3 in Ada, Java, or C#.
Figure 7.3:
Transcribed Image Text:
template
template class queue { item items [max_items]; int next_free, next_full, num_items; public: queue () : next_free (0), next_full(0), num_items (0) { } bool enqueue (const item& it) { if (num_items ++num_items; items [next_free] == max_items) return false; it; next_free (next_free + 1) % max_items; return true; } bool dequeue (item* it) { if (num_items 0) return false; items [next_ful1); --num_items; *it = next_full = (next_full + 1) % max_items; return true; }; ... queue ready_list; queue int_queue;
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 93% (15 reviews)
In ADA generic type Item is private MaxItems constant 100 with function Left Right Item return Boole...View the full answer
Answered By
Kommi Sai Swetha
I have done Masters in Science Education and my main specialization is teaching I have learn different methods of teaching for different types of students. I have been teaching online and physically for past seven years and I teach one-on-one as well group of students and a whole class. I have wonderful experience with my students. I have been using different online platform to teach.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
The INTEST instruction (code 010) allows testing of the core logic by shifting test data into the boundary scan register (BSR1) and then updating BSR2 with this test data. For input cells this data...
-
Design a Java class named Guitar that contains: A private int data field named numStrings that defines the number of strings on the guitar. The default value should be 6. A private double data field...
-
A bus has 28 seats, arranged in 7 rows and 4 columns: This seating arrangement is mapped, row-wise, to a 1D-array of size 28: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27...
-
Santa's Helpers Ltd estimates its income taxes at 35% of pre-tax income. For the quarter ended September 30, pre-tax income was $200,000. Prepare the journal entry to record the estimated income...
-
Refer to Fig. 8.9b, which shows a flow net under a dam section. The values of head for the two sides of the dam, and compute the seepage or flow rate through the dam if the dam is 120 ft long with K...
-
Gear A in Figure P12.25 is spinning such that its rotational velocity vector points in the negative \(x\) direction. It is lowered so that its edge comes in contact with the edge of gear B. What is...
-
What three functions do administrative agencies perform that are normally kept separate under the American system of government? What traditional justifications are put forth in favor of combining...
-
You wish to retire in 14 years, at which time you want to have accumulated enough money to receive an annual annuity of $17,000 for 19 years after retirement. During the period before retirement you...
-
19. Find the tension T for the system shown in figure :- T T T 1 kg 2 kg 3 kg (1) IgN (2) 2 gN (3) 5 gN (4) 6 gN 20. A ball of mass 0.5 kg moving with a velocity of 2 m/sec strikes a wall normally...
-
Consider the portion of an excavator shown. At the instant under consideration, the hydraulic cylinder is extending at a rate of 6 in. /sec, which is decreasing at the rate of 2 in. /sec every...
-
In Section 7.2.2 we introduced the notion of a universal reference type (void * in C) that refers to an object of unknown type. Using such references, implement a poor mans generic queue in C, as...
-
(a) Give a generic solution to Exercise 6.19. Data From Exercise 6.19: Write a C++ preorder iterator to supply tree nodes to the loop in Example 6.69. You will need to know (or learn) how to use...
-
What are the ultimate objectives of the EU? Identify and describe them.
-
How do digital storytelling techniques such as interactive multimedia, virtual reality, and augmented reality expand the possibilities for creating immersive imagery in literature, allowing readers...
-
Who is the current Chief Executive Officer of The Hershey Company?
-
Explain what material preparations may be required and how they will be carried out in manifacturing?
-
Maren received 12 NQOs (each option gives her the right to purchase 15 shares of stock for $9 per share) at the time she started working when the stock price was $11 per share. When the share price...
-
Sales revenue $7,541,400 Cost of goods sold Beginning inventory $1,949,500 Purchases 4,316,100 Goods available for sale 6,265,600 Ending inventory 1,452,600 Total cost of goods sold 4,813,000 Gross...
-
Why are businesses starting to incorporate sustainability into their business model?
-
The comparative statements of financial position of Menachem NV at the beginning and end of the year 2019 appear below. Net income of ¬34,000 was reported, and dividends of ¬23,000 were paid...
-
Consider the following code: Assume that the register $t1 contains the address 0x1000 0000 and the register $t2 contains the address 0x1000 0010. Note the MIPS architecture utilizes big-endian...
-
Write the MIPS assembly code that creates the 32-bit constant 0010 0000 0000 0001 0100 1001 0010 0100two and stores that value to register $t1.
-
If the current value of the PC is 0x00000000, can you use a single jump instruction to get to the PC address as shown in Exercise 2.39? Exercise 2.39 Write the MIPS assembly code that creates the...
-
Sell of Process Further Rose Hill, a soybean farm in northern Minnesota, has a herd of 50 dairy cows. The cows produce approximately 2,800 gallons of milk per week. The farm currently sells all its...
-
The 3 promotional methods to use will include digital marketing, word to mouth and branding. D g. Part 4: Promotional Strategy i. Identify a promotional mix consisting of at least three promotional...
-
Wu Inc. Statement of Income Year Ended August 31, 2024 Service revenue Operating expenses Income before income tax Income tax expense Net income Wu Inc. $ 325,000 [1] 116,000 23,000 $ [2] Statement...
Study smarter with the SolutionInn App