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
If the result is for a BART Transit Station: "Daly City Station" with the result address "Daly City,CA". What is the correct rat
Sholpan [36]

Answer:

c. Incorrect street number and correct street name

Explanation:

Bay Area Rapid Transit (BART) is a transportation system that runs along San Francisco in California. The transport system knows the streets of California because it runs on it.

The system keep on improving with time and following the trends of other transport systems in the the world, Like using the Debt cards and credit card to charge for their fares. More than 433,000 people use the transportation system in California.

From the question, The resulting address is accurate while entering ‘Dala city Station’, to the BART Transit Station, the address comes as Dala City CA 94014.

3 0
2 years ago
Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
Naya [18.7K]

Answer:

The program to this question as follows:

Program:

#include<iostream> //include header file.

using namespace std; //using name space.

int main() //main function.

{

int n,i,key; //define variable.

int a[n]; //define array

cout<<"Enter size of array :"; //message.

cin>>n; //input number from user.

cout<<"Enter array elements :"; //message

for(i = 0;i<n;i++) //loop

{

cin>>a[i]; //input array elements

}

cout<<"Enter a number:"; //message

cin>>key; //input number.

for(i = 0;i<n;i++) //loop

{

if(a[i]<=key) //if block

{

cout<<a[i]<<"\n "; //print array elements

}

}

return 0;

}

Output:

Enter size of array :7

Enter array elements :5

50

50

75

100

200

140

Enter a number:100

5

50

50

75

100

Explanation:

The description of the above program as follows:

  • In this program first, we include a header file and define the main method in method we define variables and array that are "n, i, key and a[]". In this function, all variable data type is "integer".
  • The variable n is used for the size of array and variable i use in the loop and the key variable is used for comparing array elements. Then we use an array that is "a[]" in the array, we use the for loop to insert elements form user input.  
  • Then we define a loop that uses a conditional statement in if block we check that array elements is less than and equal to a key variable. If this value is true so, we will print the remaining elements.  

4 0
1 year ago
Chinh wants to have a program print, "Sorry, but that isn’t one of your options" until the user enters the correct information.
kolbaska11 [484]

Answer:

a wile loop

Explanation:

8 0
1 year ago
Amanda a recently moved into a new home. Everyone has their own tablet, and wants to connect to the same network, no matter wher
vagabundo [1.1K]

Answer:

wifi is the best network for all, As it gets in all corners of the house.

7 0
2 years ago
Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the n
mote1985 [20]

Answer:

import java.util.Scanner;

public class VowelsAndConsonantsDemo {

   /**

   The printMenu methods displays a menu to the user

    */

   public static void printMenu() {

       System.out.println("Please select an option: ");

       System.out.println();

       System.out.print("a. Count the number of vowels in the string.\n"

               + "b. Count the number of consonants in the string.\n"

               + "c. Count both the vowels and consonants in the string.\n"

               + "d. Enter another string.\n"

               + "e. Exit the program\n");

   }

   public static void main(String[] args) {

       String input;      // to hold the user's input

       String option;     // to hold the user's input

       char choice;       // to hold a single character

       char exit;         // user chooses 'e' to exit the program

       char letter;       //the Y or N from the user's decision to exit

       // create a Scanner object to read keyboard input.

       //  Scanner keyboard = new Scanner(System.in);

       Scanner keyboard;

       do {

           keyboard = new Scanner(System.in);

           // ask user to enter string

           System.out.print("Enter a string: ");

           input = keyboard.nextLine();

           input = input.toLowerCase();

           System.out.println();

           printMenu();

           option = keyboard.nextLine();

           choice = option.charAt(0);

           VowelsAndConsonants words = new VowelsAndConsonants(input);

           switch (choice) {

               case 'a':

               case 'A':

                   System.out.println("Number of Vowels: " + words.getVowels());

                   break;

               case 'b':

               case 'B':

                   System.out.println("Number of Consonants: " + words.getConsonants());

                   break;

               case 'c':

               case 'C':

                   System.out.println("Number of Vowels & Consonants: " + words.getConsonants()

                           + words.getVowels());

                   break;

               case 'd':

               case 'D':

                   System.out.println("Enter a string: ");

                   break;

               case 'e':

               case 'E':

                   System.exit(0);

                   break;

               default:

                   System.out.println("You did not enter a valid choice.");

           }

           //

           // keyboard.nextLine();    //consumes the new line character after the choice

           // String answer = keyboard.nextLine();

           // letter = answer.charAt(0);

       } while (true);

   }

}

4 0
1 year ago
Other questions:
  • Two technicians are discussing lung protection in the shop. Technician A says that respiratory-protection devices can prevent yo
    5·2 answers
  • A program needs to allow a customer to input integers until the input number is zero. When the input number is zero, the program
    14·1 answer
  • If, instead, charge 3 is located to the left of charge 1 at a point (on the x axis) that satisfies the conditions given in the p
    7·1 answer
  • Insert the missing code in the following code fragment. This fragment is intended to call the Vehicle class's method. public cla
    14·1 answer
  • Define a method named roleOf that takes the name of an actor as an argument and returns that actor's role. If the actor is not i
    8·1 answer
  • Write a flowchart and C code for a program that does the following: Within main(), it asks for the user's annual income. Within
    12·1 answer
  • Write a program that calculates taxi fare at a rate of $1.50 per mile. Your pro-gram should interact with the user in this manne
    12·1 answer
  • The geographic coordinate system is used to represent any location on Earth as a combination of latitude and longitude values. T
    5·1 answer
  • _____________ data is what is translated to digital format so it can be stored in a computer.
    10·1 answer
  • The hostel in which you plan to spend the night tonight offers very interesting rates, as long as you do not arrive too late. Ho
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!