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...
-
Sea Spray Marine experienced these events during the current year. a. December revenue totaled $130,000; and, in addition, Sea Spray collected sales tax of 5%. The tax amount will be sent to the...
-
Model the tax consequences of a Dutch company financing its U . S . operations through debt vs . equity, assuming a 3 0 % corporate tax rate and a 5 % withholding tax on interest. Analyze the tax...
-
What are the three basic items all motions must include?
-
Developing Management skills (course name) Assignment Case: Moving up in the Rankings at the end of Chapter 3 is the assigned case for Assignment # 1 (15%) The hand-in is to record your experience...
-
Parker just won the lottery and wisely decided to invest 75% of his winning. He has allocated $50,000 for investment in a high-income growth fund. How many units can he purchase if theNAVPS is 60.1...
-
1 Carry out a PESTEL analysis of Alibaba at the time of the case. Evaluate the balance of opportunities and threats, using the same kind of figure as in Illustration 2.1. 2 Draw a basic sociogram of...
-
In treating addictions such as cocaine, group therapy is one of the key parts of the treatment process. Traditional supporters of Alcoholics Anonymous and Narcotics Anonymous do not support the ideas...
-
What is meant by content marketing with suitable case studies in content marketing? Apply content marketing fundamentals principles to develop a basic content marketing strategy and plan including:...
-
2. Art Grunnion wants to start a company which would build open-ocean speedboats of the highest possible quality. He would put $1 million into the company on October 1, 1993. Even with all its...
-
You've just been hired by Wilson Sporting Goods to develop a new pricing strategy for their softball / baseball gloves. You've been told that variable manufacturing costs for this year have been $ 3...
-
Examine the influence of oral traditions on contemporary written forms of storytelling, such as in works of Indigenous and African diaspora literature. How do these traditions shape the structure and...
-
Analyze the role of narrative voice in the development of detective fiction. How does the use of first-person and third-person narration alter the reader's experience and engagement with the mystery?
-
A B The x- and y-coordinates of a moving particle are given by the parametric equations below. Find the magnitude and direction of the velocity for the specific value of t. Sketch the curve and show...
-
Parkin Industries, a U.S. company, acquired a wholly-owned subsidiary, located in Italy, at the beginning of the current year, for 200,000. The subsidiary's functional currency is the euro. The...
-
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...
-
What problems did the developers of Chinook face? What new techniques did they add to simple Minimax with alpha-beta pruning? Would these techniques extend well to other games?
-
Explain why the alphabeta procedure will always generate the same answer as Minimax without pruning.Why is it useful?
-
Add alphabeta pruning to your program, and see what difference (if any) it makes to the number of nodes the program has to examine when playing a game.
Study smarter with the SolutionInn App