Question: This program will take an array of colors and return a String with the values associated with those colors. black=0 brown=1 red=2 orange=3 yellow=4 green=5

This program will take an array of colors and return a String with the values associated with those colors.
 black=0
 brown=1
 red=2
 orange=3
 yellow=4
 green=5
 blue=6
 violet=7
 grey=8
 white=9 

For example if the input is "blue","white","brown" the returned String would be "691" or if input is "grey" the returned String would be "8"

 

Create a class for doing work
 There should be no class level variables but initialize the color array as a class constant
 Create method that takes in string array and returns string

 

Try to put some of the work in other methods only seen by the created class

 

public class Resistor {

 

public String execute(String[] colors) {
 return null;
 }

 

 

 

Step by Step Solution

3.45 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres an example implementation of the Resistor class based on the given requirements java Copy code ... 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 Accounting Questions!