Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

Step: 1

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... blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Statistics

Authors: Neil A. Weiss

10th Edition

321989171, 978-0321989178

More Books

Students explore these related Programming questions