Question: Say you have a two-dimensional array called trafficLights that holds String values that can be red. yellow, green Newer traffic lights used orange instead of

 Say you have a two-dimensional array called "trafficLights" that holds String

Say you have a two-dimensional array called "trafficLights" that holds String values that can be "red". "yellow", "green" Newer traffic lights used "orange" instead of "yellow". The authorities want to change all "yellow" occurrences to "orange" Write a method that replaces each occurrence of "yellow" with " orange". Not all rows will have "yellow"; some will already have "orange". You can assume that each row has three elements but will not be present in any particular order. We do not know how many rows there are. To help you get started, copy the following code to write the program. But ensure that your code works for any length trafficLights array (not only for length 3 as In the example below) public static void main(String args) { String trafficLights = { {"red", "yellow", "green"), ("green", "red", "yellow"), ("red", "green", "orange"}}; 1/ ADD YOUR CODE HERE 1/ Hint: the values are String type so you can use String functions to check whether it is "yellow" or not. Second hint: You need to use nested loops (two for loops). 7 A - . = BIUS xxS/ D eam Video

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!