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...
-
On April 1, 2020, Mendoza Company (a U.S.-based company) borrowed 500,000 euros for one year at an interest rate of 5 percent per annum. Mendoza must make its first interest payment on the loan on...
-
Dudley Ltd produces two products, X and Y, at a joint cost of \($480\) 000. The company can sell 620 000 units of product X for \($30\) per unit, or the units can be processed further at a cost of...
-
Everybody knew Ed McAlister was a brilliant businessman. He had taken a small garbage collection company in Kentucky and built it up to be one of the largest and most profitable waste management...
-
How can modern computational techniques, such as molecular dynamics simulations, be used to predict phase behavior in complex mixtures, and how do these predictions inform industrial process design ?
-
After watching the video on Thailands booming economy, discuss the following: 1. How do firms in Asia (in this case, in Thailand) overcome market failure? 2. What costs and benefits do US-based Ford...
-
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...
-
In Exercises 9 through 22, find dy/dx by implicit differentiation. x 2 + y = x 3 + y 2
-
Assuming the key indigo is in all five of the files referenced in the options, which file will the following code use for the resource bundle? A. Colors_default.properties B. Colors_en_US.properties...
-
Assuming the key red is in all five of the files referenced in the options, which file will the following code use for the resource bundle? A. Colors.properties B. Colors_en_US.properties C....
-
Given the following two properties files, what does the following class output? A. Docker container B. generic container C. generic null D. The output cannot be determined without knowing the locale...
-
How do you find out the locale of the running program? A. Locale.get("default") B. Locale.get(Locale.DEFAULT) C. Locale.of() D. Locale.now() E. Locale.getDefault() F. None of the above
-
When localizing an application, which type of data varies in presentation depending on locale? A. Currencies B. Dates C. Both D. Neither
-
Wood wick Company issues 10%, five-year bonds on December 31, 2015, with a par value of $200,000 and semiannual interest payments. Use the following bond amortization table and prepare journal...
-
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...
-
A portfolio has a standard deviation of 25%. The correlation of the portfolio and the market is 1. If the risk-free rate is 3.2%, the expected return on the market portfolio is 11%, and the standard...
-
(6 pts.) The following gas phase reaction system is conducted in an isothermal constant volume batch reactor. The reactor is charged with pure A with an initial concentration CAO AB ri = k CA B D r2...
-
Based on the NPV and IRR investment criteria, should your company introduce a new candy flavor? 1) Should the cost of a marketing survey be included in your decision? Why or why not? 2) Calculate the...
Study smarter with the SolutionInn App