answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
VLD [36.1K]
2 years ago
11

A Color 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.
Computers and Technology
1 answer:
Mashutka [201]2 years ago
6 0

Answer:

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;

}

You might be interested in
Write the execution steps if the input is a lion.
balandron [24]

Explanation:

Execution step:

1. Starting the program

2. It will get the animal name

3. Check whether the animal eats only plants. Then it prints "Herbivore". If the condition is false, it prints "carnivore".

4. Stop the program

To identify input, output and decision:

Start and Stop (oval): These are neither input nor output

Does it eat only plants?: Decision making statement ("d")

Read the names of the animals(Parallelogram): Input ("i")

Print Herbivore, Print Carnivore: Output "o"

Scenario 1: Input is lion

1. Start

2. Reads the input as "lion"

3. Check if lion eats only plants. So here it is false

4. Print "Carnivore"

5. Stop

Scenario 1: Input is Elephant

1. Start

2. Reads the input as "Elephant"

3. Check if lion eats only plants. So here it is true

4. Print "Herbivore"

5. Stop

7 0
2 years ago
Write a single statement that will print the message "first is " followed by the value of first, and then a space, followed by "
nadezda [96]

Answer:

print("first is "+str(first)+" second = "+str(second))

Explanation:

The above written print statement is in python language.If first and second are strings then we need not to use str then we only have to write variable name.This statement prints the given in one line according to the question and it goes to new line after printing.

8 0
1 year ago
Which native windows application allows one to access basic pc settings and controls system info?
vlabodo [156]
As far as windows 7 and below it was control panel, but in windows 8 and higher, microsoft added, a new app which was called settings, control panel was still there but with a few features removed
7 0
2 years ago
Read 2 more answers
According to the book, if your CPU usage levels are greater than ________ during most of your work session, a faster CPU can gre
Zanzabum

Answer:

90%

Explanation:

3 0
2 years ago
Which of the following situations is most likely to cause issues arising from the digital divide?
IrinaK [193]

Answer:

A

Explanation:

I saw it on another website and got it right

7 0
1 year ago
Other questions:
  • Column, bar, pie, line, and scatter are all types of_____
    9·1 answer
  • Grabar microphone audio icon_person click each item to hear a list of vocabulary words from the lesson. then, record yourself sa
    7·2 answers
  • Which one of the following is NOT true about energy conversion devices? Group of answer choices Total Energy Input = Energy Diss
    8·1 answer
  • Use the image below to answer this question.
    14·1 answer
  • Write a function string middle(string str) that returns a string containing the middle character in str if the length of str is
    13·1 answer
  • In a survey of 7200 T.V. viewers, 40% said they watch network news programs. Find the margin of error for this survey if we want
    6·1 answer
  • Server farms such as Google and Yahoo! provide enough compute capacity for the highest request rate of the day. Imagine that mos
    12·1 answer
  • 3.34 LAB: Mad Lib - loops in C++
    14·1 answer
  • Write a MATLAB function named average_of_scores_with_drops The function will have two inputs and two return values. The first in
    11·1 answer
  • Here is a super challenge for you if you feel up for it. (You will need to work this out in Excel.) In 2017 the Islamic month of
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!