In this exercise, you are asked to first refactor several parts of What To Eat.java. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this exercise, you are asked to first refactor several parts of What To Eat.java. The purpose is to make code cleaner and more readable, which will make it easier in your last task to add a new feature. 6. Refactor the example script WhatToEat.java. Notice the multiple usages of JButton, in particular, selectButton and addOptionButton. Create a new intermediary class OptionButton that handles all the buttons in our example and modify all usages of JButton. 7. Refactor the example script What To Eat.java. Notice the multiple usages of JLabel. Do the two following: a. Create a new intermediary class TextLabel that handles all the labels and modify all usages of JLabel; b. A new request now comes in: we would like to restrict the total number of characters shown in our label. Modify TextLabel so that only the first 10 characters of the text will be shown. To do this, you may want to override the inherited setText method. 8. Another request now comes in: users would like to remove options. Add this new feature to WhatToEat.java. } public static void main (String[] args) { Personnel [] personnels = new Personnel [3]; personnels [0] = new Student (); personnels [1] = new Faculty(); personnels [2] = new Service (); canPark InLot (personnels); } In this exercise, you are asked to first refactor several parts of What To Eat.java. The purpose is to make code cleaner and more readable, which will make it easier in your last task to add a new feature. 6. Refactor the example script WhatToEat.java. Notice the multiple usages of JButton, in particular, selectButton and addOptionButton. Create a new intermediary class OptionButton that handles all the buttons in our example and modify all usages of JButton. 7. Refactor the example script What To Eat.java. Notice the multiple usages of JLabel. Do the two following: a. Create a new intermediary class TextLabel that handles all the labels and modify all usages of JLabel; b. A new request now comes in: we would like to restrict the total number of characters shown in our label. Modify TextLabel so that only the first 10 characters of the text will be shown. To do this, you may want to override the inherited setText method. 8. Another request now comes in: users would like to remove options. Add this new feature to WhatToEat.java. } public static void main (String[] args) { Personnel [] personnels = new Personnel [3]; personnels [0] = new Student (); personnels [1] = new Faculty(); personnels [2] = new Service (); canPark InLot (personnels); }
Expert Answer:
Answer rating: 100% (QA)
It seems youve shown me two unrelated images The first image contains refactoring tasks for a Java script named WhatToEatjava involving the use of JBu... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
A number of nutritionists have argued that fastfood restaurants have a negative effect on nutrition quality. In this exercise you are asked to determine if there is evidence to conclude that...
-
Show that is one-to-one and find f(x) = J2 1 + 1 dt
-
The sanding department of Hanninen Furniture Company has the following production and manufacturing cost data for March 2016, the first month of operation. Production: 11,000 units finished and...
-
Tryon Medical Services Inc is a corporation in a partnership with Jordan. The sole business of the partnership has been leasing premises that the partnership owns to Elton Medical Clinic. Elton...
-
Explain how search can be used to solve constraint satisfaction problems, such as the eight-queens problem. What difficulties arise when such problems become extremely large (e.g., the...
-
Selected sales and operating data for three divisions of three different companies are given below: Required: 1. Compute the return on investment (ROI) for each division, using the formula stated in...
-
Show workings ( 1 ) You visited Port's Auto Parts and purchased the following items: a . 2 control arm bushings @ $ 1 0 0 0 each b . 2 park lamps RH Toy / Camry LHD @ $ 3 7 5 0 each ( 2 ) Compute...
-
It has been proposed that oxygen be separated from nitrogen by absorbing and desorbing air in water. Pressures from 101.3 to 10,130 kPa and temperatures between 0 and 100C are to be used. (a) Devise...
-
Consider a magnetic disk drive with 8 surfaces, 512 tracks per surface, and 64 sectors per track. Sector size is 1 kB. The average seek time is 8 ms, the track-to-track access time is 1.5 ms, and the...
-
A shaft with diameter 80 mm rotates at 400 r/min within a bearing. The coefficient of friction between the contact surfaces is 0,04. The radial force exerted by the shaft on the bearing is 30 kN,...
-
Mr. Slim Shady is a well-known blacksmith, an expert on making kitchen knives. He is currently working on a project for the President of Indonesia. He prepares a 1.2 kg metal bar (iron) initially at...
-
. Calculate the reaction forces at pins A and C, as well as the force exerted at pin B (a) without employing the concept of two-force members and (b) by utilizing the concept of two-force members (25...
-
The steel plate shown has a central 40 mm crack which is normal to the direction of the applied load (P) of 217 kN. Material tests indicate that its Mode 1 Fracture Toughness is 25 MPa/vm. The...
-
In this part, your goal is to derive the transfer function representation for the rotational mechanical system composed of two inertias Um and JL) and a damper (B) shown on the right. The input of...
-
Wholesalers Ltd. deals in the sale of foodstuffs to retailers. Owing to economic depression, the firm intends to relax its credit policy to boost productivity and sales. The firms current credit...
-
Write a program to move a signed number from smaller register to bigger register. Hint: movzx ax, bl Topic: Data Related Operators and Directives in assembly language
-
The National Governors Association publishes data on U.S. governors in Governors' Political Affiliations & Terms of Office. Based on that document, we obtained the following frequency distribution...
-
A person is said to be overweight if his or her body mass index (BMI) is between 25 and 29, inclusive; a person is said to be obese if his or her BMI is 30 or greater. From the document Utah...
-
The Belmont Stakes is the third leg, after the Kentucky Derby and Preakness Stakes, of the Triple Crown of thoroughbred horseracing. The morning-line betting odds of the two favorites, Orb and...
-
Consider the diffraction pattern shown actual size in Figure 34.40. If the pattern was formed by light from a \(623-\mathrm{nm}\) (red) laser passing through a single narrow slit and the screen on...
-
An astronomer wishes to determine the relative heights of the intensity peaks for the bright fringes produced by two wavelengths of radiation emitted by sodium atoms. The wavelengths are \(589.0...
-
A 50 -W incandescent light bulb emits about \(5.0 \mathrm{~W}\) of visible light. (The rest is converted to thermal energy.) If a circular aperture \(5.0 \mathrm{~mm}\) in diameter is placed \(1.0...
Study smarter with the SolutionInn App