Answered step by step
Verified Expert Solution
Link Copied!

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) {

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions