CSE 114 Study Guide - Final Guide: Mutator Method, Instance Variable

26 views2 pages

Document Summary

Be sure to show your code to one of the lab tas before you leave, so that you can receive credit for this lab. The class also has a private string instance variable that represents the name of the color (e. g. , "salmon" or "teal"). The color class has a constructor that takes three integer arguments, representing the color"s red, green, and blue components; it assigns the value null (note: this is a literal value, not the string null ) to the color name. A second constructor takes three integers and a string as arguments, and assigns them to the appropriate instance variables. Finally, the class has public accessor methods for all four variables: next, define a subclass of color named alphachannelcolor. Alphachannelcolor has one additional private instance variable: an integer that represents the color"s degree of transparency (0 is fully opaque, and 255 is fully transparent). Finally, override the getcolorname() accessor method that you inherited from.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers

Related Documents

Related Questions