Question: 51. You coded the following definition for the Grade class: public class Grade { } private char letterGrade; public Grade (char lg ) {






51. You coded the following definition for the Grade class: public class Grade { } private char letterGrade; public Grade (char lg ) { letterGrade = lg; } public String toString() { return lg; } // line 10 // line 11 // line 12 // line 13 When you compile, you get the following message: Grade.java:12: error: cannot find symbol return lg; // line 12 symbol: variable lg location: class Grade 1 error Explain what the problem is and how to fix it. 17. Consider the following method header: public Color getColor() Is this method a constructor, mutator, or accessor? 18. Consider the following method header: public void setColor ( Color c) Is this method a constructor, mutator, or accessor? 29. Declare a class field for a federal tax rate, a constant, with value .07. // declare federal tax rate constant; value is 0.07 31. Code a constructor for that class that takes three parameters. // your constructor code goes here 36. Code a method returning the number of digits in the channel number. For instance, if the channel number is 21, the method returns 2; if the channel number is 412, the method returns 3. // your code goes here 37. Code a method returning the word cable if the current object represents a cable channel and returning the word network if the current object does not represent a cable channel. // your code goes here 39. We are coding the following inside the class Gift; where is the error? public void setOccasion ( String occasion ) { } occasion = occasion; 46. Where are the errors in the following statement? enum Months = { "January", "February", "March" };
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
