Question: 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

In this exercise, you are asked to first refactor several parts of What To Eat.java. The purpose is to make } public static void main(String[] args) { Personnel [] personnels = new Personnel [3]; personnels [0] = new

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); }

Step by Step Solution

3.42 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

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 full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!