Answer:
The following are the code in the Java Programming Language.
//define a class and inherit the other class
public class AlphaChannelColor extends Color {
//define constructor and pass arguments
public AlphaChannelColor(int red, int green, int blue, int alpha) {
super(red, green, blue);
this.alpha = alpha;
}
//define function
public int getAlpha()
{
return alpha;
}
//declare a private type variable
private int alpha;
}
Step-by-step explanation:
The following are description of the program.
- Firstly, define a class 'AlphaChannelColor' that inherits the other class that is 'Color' through the extend keyword.
- Define the constructor (in Java, the class name and the name of the constructor remain same) and pass four integer data type arguments 'red', 'green', 'blue' and 'alpha' in its parameter.
- Define the integer data type function 'getAlpha()' that returns the value of the variable 'alpha'.