Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following class contains several errors that violate the rules of Java: 1. class Thermometer { 2. private int temperature 3. public Thermometer(int degrees) {
The following class contains several errors that violate the rules of Java: 1. class Thermometer \{ 2. private int temperature 3. public Thermometer(int degrees) \{ 4. temperature = degrees; 5. } 6. public Thermometer() \{ 7. temperature =0.0; 8. } 9. public void makeWarmer(int degrees) \{ 10. temperature =+ degrees; 11. } 12. public void makecooler(int degrees) \{ 13. temperature = degrees; 14. 15. public getTemperature() \{ 16. return temperature; 17. 18. public string tostring() \{ 19. return temperature + "degrees'; 20. } 21. \} Describe each error and specify whether it is (a) lexical, (b) syntactic, or (c) semantic. Use the numbers shown to identify the line on which each error occurs
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started