Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part la 00 pts) Use the Temperature as o alisw questions public class Temperatur

ID: 3790959 • Letter: P

Question

Part la 00 pts) Use the Temperature as o alisw questions public class Temperature Il temperature stored in Celsius units private double temp; llPOST: temperature initialized to 0 degrees C public Temperature temp -0.0; public Temperature (double t) ll POST: temperature initialized to t degrees C temp public void set'Temp (double ll POST: temperature set to t degrees C temp t;) public double getTemp POST: return the Celsius temperature return temp; public double convert ll POST: return the Fahrenheit equivalent return 9.0/5.0 temp 32.0; public boolean equals(Temperature other) "POST: return true if same temperature return temp 1. (2) The main method of a client class attempts the following code to set object winter temperature but an error results. What is the cause of the problem? Temperature winter; winter.set Temp (23); a. The setTemp method expects to be passed a double value. b. Method setTemp returns a value so cannot be called on a line by itself. c. Method setTemp cannot be called by code outsid the Temperature class. d. No object has yet been created so the setTemp method cannot be invoked. 2. 2) Write code to display "SAME" if the two objects t1 and 12 store the same temperature Temperature ti new Temperature Temperature 12 new Temperature (32.5);

Explanation / Answer

1. [d] No object has yet been creted.
explanation : To call any method outside of a class , instance of the class is req.

2. if (t1.temp == t2.temp)
   {
    System.out.println("SAME");
   }

3. [a]. the temp memeber of object day stores values = 0.0
   explanation : when new operatore invoked automatically called matched constructor.

4. [a]. dependency.

5. [b] private,public

6. [c] values[1] = 2.5;
   explanation : array postion start from 0

7. [c]

8. [A]  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote