subject

Acolor class has a method getcolorname that returns a string corresponding to the common name for the color, e. g., yellow, blue, white, etc. if there is no common name associated with the color, null is returned.

the class , alphachannelcolor– a subclass of color– has an integer instance variable , alpha, containing the alpha channel value , representing the degree of transparency of the color.

write the method getcolorname of alphachannelcolor, that overrides the method in the color class . alphachannelcolor’s getcolorname should return the name of the color (obtained from the getcolorname method of color) prefixed with the word ‘opaque’ if the alpha value is less than 100, ‘semi-transparent’ if the alpha value is otherwise less than 200, and ‘transparent’ otherwise (separate the prefix from the color name by a blank). if the color has no name , the method should return "opaque color", "semi-transparent color", or "transparent color", according the the same alpha values as above.

i have the code for the alphachannelcolor class:

public class alphachannelcolor extends color
{

@override
public string getcolorname()
{
string name = super. getcolorname();
if (name == null) name = "color";
if (alpha < 100)
return "opaque " + name;
else if (alpha < 200)
return "semi - transparent " + name;
return "transparent " + name;
}
}

what would the code look like for the color class?

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:00
So im doing this school challenge and the teachers said whats the average text a student gets a day so i need to get about 20 in a day but dont know how can you guys 2163371293
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
When writing a business letter, how many times can you use the same merge field in a document? once once, unless using the address block feature unlimited it will depend on the type of document you choose
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Think of a spreadsheet as a giant calculator spread of paper chart data collector
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
In a home that has 120 v service, there is an electric appliance that has a resistance of 12 ohms. how much power will this appliance consume? a. 10 w b. 120 w c 1200 w d. 1440 w
Answers: 1
You know the right answer?
Acolor class has a method getcolorname that returns a string corresponding to the common name for th...
Questions
question
Mathematics, 14.06.2020 23:57
question
Mathematics, 14.06.2020 23:57
question
Mathematics, 14.06.2020 23:57
Questions on the website: 13722361