A Color class has a method getColorName that returns a String corresponding to the common name...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 int instance variable, alpha, containing the alpha channel value, representing the degree of transparency of the color. Write the method getColorName of AlphaChannelColor, which 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 to the same alpha values as above. 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 int instance variable, alpha, containing the alpha channel value, representing the degree of transparency of the color. Write the method getColorName of AlphaChannelColor, which 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 to the same alpha values as above.
Expert Answer:
Answer rating: 100% (QA)
Based on the instructions in the image we want to write a method getColorName that overrides the met... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Google is one of the most successful organizations of our time. It has the fourth-highest market capitalization in the world and has been named by Great Place to Work and Fortune Magazine as the #1...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In which rways can social media platformsbe used to advance your career or open new career opportunities? How can social media platforms hurt your chances for advancement in the workplace?
-
Jen and Berry's sells ice-creams from its factory-shop in Petone. There is a managing director (Maynard Dibble), a marketing manager (Mary Salman) and a production manager (Peter Pritchard). Maynard...
-
During 2012, Trombley Incorporated has the following inventory transactions. For the entire year, the company sells 50 units of inventory for $20 each. Required: 1. Using FIFO, calculate (a) ending...
-
The MyLinkedList class used in Listing 24.5 is a one-way directional linked list that enables one-way traversal of the list. Modify the Node class to add the new data field name previous to refer to...
-
Journalize the following transactions for the Jazz Man music store. a. Purchased $8,700 of merchandise on account, terms 2/10, n/30, FOB ship ping point. b. Paid $175 to the freight company for the...
-
Jerry Stevenson is the manager of a medical clinic in Scottsdale, AZ. He wants to analyze patient data to identify high-risk patients for cardiovascular diseases. From medical literature, he learned...
-
How important is DNA to Law enforcement? Should arrested (not convicted Individuals) be forced to provide DNA samples to the police? Please do not copy and paste about the blue print one i need...
-
Byrd Company produces one product, a putter called GO-Putter. Byrd uses a standard cost system and determines that it should take one hour of direct labor to produce one GO-Putter. The normal...
-
An arrangement under which reimbursements for expenses incurred by employees are NOT included in an employee's gross income or reported on the employee's Form W-2?
-
Can someone give me some ideas for the questions below? It doesn't have to be a long explanation. Just a few words. 1. In what ways can mental health conditions and access to mental health care are...
-
The company has the following fixed costs: Product A, $613,000, Product B, $1,023,000, and common fixed costs of $372,800. Using the above information answer the following questions. What is the...
-
Sincell Corporation uses customers served as its measure of activity. During April, the company budgeted for 22,000 customers, but actually served 24,000 customers. The company uses the following...
-
Describe the complexities involved in thread termination and cleanup. What mechanisms do operating systems provide for safe thread termination, and how can improper thread cleanup lead to resource...
-
Discuss the concept of thread safety and the role of immutable data structures in multi-threaded applications. How can the use of immutable data help reduce synchronization overhead and prevent data...
-
ABC company is thinking to change the capital structure of the firm. The Company has a total asset of OMR 40,000,000, and OMR 8,500,000 of EBIT and is taxed at a rate of 40%. If the book value per...
-
What are the before image (BFIM) and after image (AFIM) of a data item? What is the difference between in-place updating and shadowing, with respect to their handling of BFIM and AFIM?
-
Write a JavaFx application that displays a series of pictures of a person with arms, legs, and of course a head. Use a happy face for the head. Use ovals for the body, arms, and legs. Draw a sequence...
-
Repeat Programming Project 10 from Chapter 5 but use an array to store the movie ratings instead of separate variables. All changes should be internal to the class, so the main method to test the...
-
Write an exception class that is appropriate for indicating that a time entered by a user is not valid. The time will be in the format hour:minute followed by am or pm.
-
Flow occurs in a rectangular channel of \(6 \mathrm{~m}\) width and has a specific energy of \(3 \mathrm{~m}\). Plot accurately the relation between depth and specific energy. Determine from the...
-
A rectangular channel carries a discharge of \(10 \mathrm{ft}^{3} / \mathrm{s}\) per foot of width. Determine the minimum specific energy possible for this flow. Compute the corresponding flow depth...
-
Flow in the channel of Problem 11.15 has a specific energy of \(4.5 \mathrm{ft}\). Compute the alternate depths for this specific energy. Data From Problem 11.15 11.15 A rectangular channel carries a...
Study smarter with the SolutionInn App