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
-
Please help finish this problem for a rolodex program. each level needs to work so please indicate where code for level 1,2 & 3 is written. code for main.cpp: (wrong, please fix) #include #include...
-
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...
-
Use the method of Example 1 and the LU-decomposition To solve the system 3x1 - 6x2 = 0 -2x1 + 5x2 = 1 2 1 2 2 2
-
Suppose that the weather in Charlotte is modeled using the Markov chain in Section 10.1, Exercise 28. If it rained yesterday and today, how many days on average will it take before there are two...
-
In Example 13-1, we assumed we were going to use all available solvent. There are other alternatives. Determine if the following alternatives are capable of producing outlet water of desired acetic...
-
The following are the financial statements of Post Corporation and its subsidiary, Sage Company, as at December 31, Year 3: Additional Information ¢ Post purchased 70% of the outstanding shares...
-
Review Assignment #2: Goulet Inc. Goulet Inc. Lawrence Goulet $81,240 30,090 27,600 9,200 148,130 175,000 -92,000 83,000 $231,130 $29,200 $17,000 $9,600 22,560 $78,360 33,840 $112,200 93,200 25,730...
-
Assume today is t=0. A 10-year fixed rate bond with a 5% coupon rate is selling at par (annual coupons). From $200 FV of this bond, we form a floater and an inverse floater by equally splitting its...
-
Question 6 Let S = $100, K = $95, = 30%, r =8%, T = 1, and = 0. For simplicity, let u = 1.3, d = 0.8 and n = 2 (that is, 2 periods). When constructing the binomial tree, what is the stock price at...
-
LongBoard Products has lowered its prices by 10% over the year and this year annual sales increased by 20% to $4,461,072.Some of the new customers (retail stores) are taking a lot longer to pay and...
-
(30.3) Show that for a gas of fermions with density of states g(E), the chemical potential is given by H(T) = Er - T2 ( 6 -(KBT) 29 (EF) g(EF) +... (30.64)
-
CORRECTLY. Show your work in good form and clear explanation. On December 31, 2021, a physical count in Lincoln Company's warehouse showed goods with a costof $5,000,000. However, after further...
-
Consider the following information about Stark Industries' Shields Division. Stark Industries is considering adding a vibranium shield to the Iron Man Suits the company manufactures for the U.S....
-
Scissors" is a hair salon. John is an owner of Scissors" salon. Presently the salon has 500 regular clients. Each client spends on average 1,000 PLN per year in the salon. Scissors" salon offers...
-
Find the value of an investment of $20,000 for 13 years at an annual interest rate of 3.85% compounded continuously The value of the investment is $?
-
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...
-
What are trend percentages and how are they calculated? What pitfalls must financial statement users avoid when preparing trend percentages?
-
During the past year, Lite Company had net income of \(\$ 5\) million, and Scanlon Company had net income of \(\$ 8\) million. Both companies manufacture electrical components for the construction...
-
Blare Company had a return on sales of 6.5 percent and an asset turnover of 2.40. What is Blare's return on assets?
Study smarter with the SolutionInn App