Reorganize the code of the sorting animation in Section 22.6 so that it can be used for
Question:
Reorganize the code of the sorting animation in Section 22.6 so that it can be used for generic animations.
Provide a class Animated with abstract methods
Transcribed Image Text:
public void run() public void draw (Graphics g, int width, int height) and concrete methods public void lock() public void unlock (int steps) public void setComponent (JComponent component) so that the Selection Sorter can be implemented as public class Selection Sorter extends Animated { private int[] a; private int marked Position = -1; private int alreadySorted = -1; public Selection Sorter(int[] anArray) { a = anArray; } public void run() { } for (int i = 0; i < a.length 1; i++) { } int minPos= minimumPosition (i); lock(); ArrayUtil.swap(a, minPos, i); alreadySorted = i; unlock(2);
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 0% (2 reviews)
From the context of the question youve provided its clear you are dealing with a Java program that contains an animation of a sorting algorithmin this case selection sort The goal is to refactor the c...View the full answer
Answered By
Branice Buyengo Ajevi
I have been teaching for the last 5 years which has strengthened my interaction with students of different level.
4.30+
1+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Java Programming questions
-
ttth Suppose that the sequence of bags {Bn | n N} is recursively enumerated by the computable function e(n, x) = fn(x), [7 marks] Hence prove that the set of all recursive bags cannot be recursively...
-
Consider the trigonometric series a0 2 + X r=1 (ar cos rx + br sin rx) where a0, a1, a2, . . . and b1, b2, . . . are constants and suppose that f(x) is a periodic function of x with period 2. (a)...
-
for the equality test for M and N. The question concerns how to represent multisets of strings within ML. For each of the given data representations (a), (b) and (c) describe how you would implement...
-
Hatch plc has two classes of share capital outstanding: 8%, 20 par preference and 5 par ordinary. At December 31, 2021, the following accounts were included in equity. Share CapitalPreference,...
-
A well-insulated 4-m x 4-m x 5-m room initially at 10C is heated by the radiator of a steam heating system. The radiator has a volume of 15 L and is filled with superheated vapor at 200 kPa and 200C....
-
Which three things are pinpointed when using behaviour modification?
-
What is the difference between strategic business planning and sales and operations planning (SOP)? What are the major benefits of SOP? LO.1
-
Northwest Aircraft Industries (NAI) was founded 45 years ago by Jay Preston as a small machine shop producing machined parts for the aircraft industry, which is prominent in the Seattle/Tacoma area...
-
Which construction projects used mid range plasticizer in their concrete
-
Consider a building whose annual air-conditioning load is estimated to be 120,000 kWh in an area where the unit cost of electricity is $0.10/kWh. Two air conditioners are considered for the building....
-
What is the IP address of the computer that you are using at home? Does it have a domain name?
-
Enhance Exercise Graphics P22.8 so that it shows two frames, one for a merge sorter and one for a selection sorter. They should both sort arrays with the same values. Data from exercise graphics...
-
What are the Statements on Standards for Tax Services? Who issues them?
-
(b) A cylindrical storage tank with base area 90 m is being filled with water through an entry duct with cross-section area 250 cm, as shown in Figure 3. Concurrently, water is being extracted from...
-
Po A cylinder/piston arrangement contains 5 kg of water at 100 C with x= 20%. Initially the piston of mass m, 75 kg rests on a set of stops (see figure). The outside pressure is 100 kPa, and the area...
-
TABLE 2 Present Value of an Annuity of $1 n 123456 8% 9% 0.925926 0.917431 4 7 8 9 10 11 12 13 14 15 16 17 11.652296 10.837770 10.105895 9.446649 12.165669 11.274066 10.477260 9.763223 18 19...
-
There are 4 suits (heart, diamond, clover, and spade) in a 52-card deck, and each suit has 13 cards. Suppose your experiment is to draw one card from a deck and observe what suit it is. Express the...
-
Write isotopic symbol of zirconium and how many neutrons are present in one atom of this isotope
-
What does the Keynesian model predict about monetary neutrality (both in the short run and in the long run)? Compare the Keynesian predictions about neutrality with those of the basic classical model...
-
d) For die casting processes: 1. What are the most common metals processed using die casting and discuss why other metals are not commonly die casted? 2. Which die casting machines usually have a...
-
Which of the following keywords allows the user to delete a record from a table, even if rows in another table reference the record through a FOREIGN KEY constraint? a. CASCADE b. CASCADE ON DELETE...
-
Which of the following data dictionary objects should be used to view information about the constraints in a database? a. USER_TABLES b. USER_RULES c. USER_COLUMNS d. USER_CONSTRAINTS e. None of the...
-
Which of the following types of constraints cant be created at the table level? a. NOT NULL b. PRIMARY KEY c. CHECK d. FOREIGN KEY e. None of the above constraints can be created at the table level.
-
Ted and his partners have contracted to purchase the franchise nights worth 561 000 to open and operate a specialty pizza restaurant called Popper with a renewable agrement, the partners have agreed...
-
Your answer is partially correct. Martin Company's chief financial officer feels that it is important to have data for the entire quarter especially since their financial forecasts indicate some...
-
Kellog Corporation is considering a capital budgeting project that would have a useful life of 4 years and would love testing 5156.000 in equipment that would have zeto salvage value at the end of...
Study smarter with the SolutionInn App