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...
-
What type of analytics addresses the question of whether an audit firm should accept or reject an audit client? a. Descriptive analytics b. Diagnostic analytics c. Predictive analytics d....
-
Why is the range value affected by outliers?
-
The McDuff Credit Union advertises their ability to quickly process personal loan applications for their members. As seen in Table 11.18, the loan process requires four steps and takes approximately...
-
Wildhorse Company incurred research and development costs of $97000 to develop a patent, and legal fees of $37000 to register the patent. The patent has a legal life of 20 years and a useful life of...
-
Allie has bought a new apple orchard. The orchard has a single file of trees, numbered from 1 to N. Each tree has a certail number of ripe apples. Allie has a rule she wants to follow. She wants to...
-
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...
-
The cradle-to-gate inventory of acetic acid includes the following emissions to air: 5.70E-04 kg of ammonia, 1.76E-03 kg of carbon dioxide, 3.97E-03 kg of carbon monoxide, and 4.00E-05 kg of...
-
Annual depreciation $ 2,600 Annual mileage 20,400 Current years loan interest $ 1,100 Miles per gallon 24 Insurance $ 1,090 Average gasoline price $ 3.40 per gallon License and registration fees $ 74...
-
sheila pays corporate taxes. the girm has a debt equity ratio of 1. the pre tax cost of debt if 1.5% while the unlevered cost of capital is 10%. what is the approximate cost of equity if the tax rate...
-
the bakery has 10.5 dozen of donuts. they sold 2/3 of donuts . how many donuts did the sell?
-
Using the below information from Pennington Corp., prepare a schedule of cost of goods manufactured and a schedule of cost of goods sold. Assume Pennington closed underapplied or overapplied Overhead...
-
Fisher Enterprises assets increased from $7,800 to $8,600, and liabilities decreased from $3,800 to $3,500. Assuming no additional owners' equity transactions took place, if expenses totaled $3,000,...
-
To raise cash for future expansion, Alex Kerr incorporated his proprietorship and created Kerr Consulting Corporation. Kerr Consulting Corporation is authorized to issue an unlimited number of common...
-
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...
-
Show the adjusting entries that you would make given the additional data below. In addition to the formal journal entry, please also indicate the type of adjusting entry that is being made, ...
-
I need one to three paragraphs written about the awk command in unix. Everything should be in a power point presentation. Make sure it contains the following: Command name Description How to use the...
-
If a firm does not grow as expected subsequent to convertible or bond-with-warrant issues, does that make it more or less likely that the securities will be converted or exercised?
Study smarter with the SolutionInn App