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: 82% (17 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...
-
If you put $200 in a savings account at the beginning of each year for 10 years and then allow the account to compound for an additional 10 years, how much will be in the account at the end of the...
-
Psychology of waiting in line. While waiting in a long line for service (e.g., to use an ATM or at the post office), at some point you may decide to leave the line. The Journal of Consumer Research...
-
The following on-boarding process for new employees has two stages. In the first, employees fill out several government forms and necessary visas for immigration. In the second the employees attend...
-
! Required information [The following information applies to the questions displayed below.] On January 1, Year 1, the general ledger of a company includes the following account balances: Credit...
-
Determine the maturity date and compute Interest for each note. Contract Date Interest Note 1. 2. Principal $17,000 22,000 15,000 Period of Nete (Tern) 60 days 90 days 45 days Rate March B 6% May 22...
-
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...
-
Managing diversity is not an easy task. Several issues, such as conflict, isolation, and discrimination, may exist within diverse work groups. In certain situations, diversity may trigger social...
-
2. (40 marks) Solve for y(t) such that y" - 6y' + 15y = 2 sin(3t),
-
6. Determine output class A{ ); } public static void main(String args[]) { int x; x = 10; if (x == 10) { int y = 20; System.out.print ("x and y: y = x*2; + y); } y = 100; } System.out.print ("x and...
-
Anita and Bonita have been roommates for the past two years while they've been in graduate school. Now that they're graduating, they are each planning to move to different cities. Their one joint...
-
To what extent are business ethics assumed, or taken for granted, by people in businesses?
-
Empowered by what he has learned in this class about gender, Brady makes a friendly wager with his girfriend, Marlisa: "I bet I can guess how the men and women at the next table will behave during...
-
Write each expression in Problems as the sum or difference of two logarithmic functions containing no exponents. log 5 (x 2 / x + 4)
-
Wimot Trucking Corporation uses the units-of-production depreciation method because units-of-production best measures wear and tear on the trucks. Consider these facts about one Mack truck in the...
-
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...
-
How to solve general ledger cash balance chapter 9 assignment 5
-
On 31 July 2018, Sipho bought 1 000 ordinary shares in ABC Ltd at a cost of R2 750. On 31 December 2018 the company made a 1 for 10 bonus issue. On 31 March 2019, Sipho sold 300 shares for R800. What...
-
If you purchase a $1000 par value bond for $1065 that has a 6 3/8% coupon rate and 15 years until maturity, what will be your annual return? 5.5% 5.9% 5.7% 6.1%
Study smarter with the SolutionInn App