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...
-
The Brown Shoe Company produces its famous shoe, the Divine Loafer that sells for $60 per pair. Operating income for 2011 is as follows: Sales revenue ($60 per pair) $300,000 Variable cost ($25 per...
-
Which of the following assertions is inaccurate concerning audit evidence? (a) Audit evidence consists of all the information, whether obtained from audit procedures or other sources (b) Audit...
-
Beeler Furniture Company deposits all cash receipts each Wednesday and Friday in a night depository, after banking hours. The data required to reconcile the bank statement as of June 30 have been...
-
It's advanced accounting homework. Assignment 1 The following are the statements of financial position of Pirate ple and Saint ple for the year ended 31 December 2010. Statement of Financial position...
-
FIGURE P23.44 shows a thin rod of length L with total charge Q. Find an expression for the electric field E at point P. Give your answer in component form. P FIGURE P23.44 + + + + + + + + +
-
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...
-
For the binomial experiments in Problem, find the normal approximation of the probability of no more than 450 successes in 1000 trials if p = 0.4.
-
The initial margin on a GBP futures contract is $2035 and maintenance is $1850. You buy one contract (62,500 Pounds) at $1.3100 and place $2035 in your account. The price of your contract drops to...
-
The Qwik Market & Branding Company has found the following results of married people in a taste test of a popular high energy drink. Wife Prefers Wife Does Not Prefer Husband Prefers .08 .06 Husband...
-
12 Stiler XYZ currently has an enterprise value of $600 million, 20 million shares outstanding, $200 million in excess cash and no debt. Assuming XYZ uses its excess cash to repurchase shares, and...
-
A steel cable that weighs 8 lb/ft is used to pull a 500 lb block of concrete from the ground to the top of a 120 ft tall building. Let x be the distance, in feet, from the block to the TOP of the...
-
Simplify. -2v 3 3 4 Write your answer without parentheses.
-
Modify the Anagrams program to enforce the constraint that words must be at least four letters long. (This is not necessary if all shorter words are removed from the file words.txt.) import...
-
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...
-
2x1 + 4x2 3, 0 x 1, 0 x 1.
-
buildtree (T) : readln (L,,,, lowercase), processlist (L, nil,T). run print ('Please enter integers to build a tree: '), buildtree (T), print('Here is the tree:'), print (T), print('\PYGZbs (n'}),...
-
subject to: Maximize 6x + 14x2 + 13x3, x+2x2+4x324 (Metalworking capacity), x1+2x2+4x360 (Woodworking capacity), x10, x2 0, x3 0, obtaining an optimal tableau:
Study smarter with the SolutionInn App