51. You coded the following definition for the Grade class: public class Grade { } private...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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" }; 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" };
Expert Answer:
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
After the car reaches 1 0 0 km / hthe driver immediately steps on the brakes and comes to a stop in 2 . 5 5 s . The brakes are at a distance 1 5 . 9 cm from the center of the wheel and the force they...
-
If no molecules in a body could escape, would the body have any odor?
-
Decide whether each equation has a graph that is symmetric with respect to the x-axis, the y-axis, the origin, or none of these. x - y = 0
-
Plaintiff contracted to install a boiler for defendant. After plaintiff had installed and tested the boiler, but before final payment to plaintiff had been made, defendant took custody of the boiler...
-
Jasmine Park encountered her boss, Rick Gompers, at the pop machine in the lobby. Rick is the vice president of marketing at Down South Lures Corporation. Jasmine was puzzled by some calculations she...
-
Hybrid agreements (also called wait-and-see agreements), which usually allow the issuer first priority to buy the interest and other stockholders or partners the second-place option to buy. Such...
-
INCOME TAX Calculation of Gross Total Income Practical Question and Answers: Mr. Eric has the following incomes during the year 2016-17. 1. Income from salary in India from an American Company 2....
-
Could you elaborate on the primary roles and functionalities fulfilled by an operating system, utilizing advanced terminology?
-
In what ways has the field of biology influenced societal advancements, particularly in the context of innovations within the healthcare sector?
-
If an item costs $5 in the US, assuming purchasing power parity with current exchange rates of $1.25/, what is the price of the item in the Germany? If, over the next year, inflation is 6% in Germany...
-
A steady-state, adiabatic compressor operates with the inlet and exit conditions listed below. The fluid is ammonia. Kinetic and potential energy changes are negligible. The mass flowrate through the...
-
Point out all the types of controls you will use in your proposed health care business and briefly explain their implementation. Present the financial statement of income and expenses for your first...
-
a)Write the names of the components of the hydraulic system given above in the form of a table. b)Explain the working principle and function of the hydraulic system using the components you listed....
-
Why is inventory management important for merchandising and manufacturing firms and what are the main tradeoffs for firms in managing their inventory?
-
Create a class TicTacToe that will enable you to write a program to play Tic-Tac-Toe. The class contains a private 3-by-3 two-dimensional array. Use an enum type to represent the value in each cell...
-
Write a program that uses a String method split to tokenize a line of text input by the user and places each token in a TreeSet. Print the elements of the TreeSet.
-
Combine the statements that you wrote in Exercise 3.5 into a Java application that calculates and prints the sum of the integers from 1 to 10. Use a while statement to loop through the calculation...
-
When adopting resource-leveling heuristics, which of the following are relevant decision rules? a. The activities with the least slack time should have resources allocated to them first b. The...
-
Project resource constraints can involve any of the following examples? a. Poorly trained workers b. Lack of available materials for construction c. Environmental or physical constraints of the...
-
When are the resource requirements estimated? a. After the activities have been defined but before the schedule has been developed b. After the schedule has been developed but before the activities...
Study smarter with the SolutionInn App