Question: Write java program 1. Assume that two classes 'Temperature' and 'Sensor' have been defined. 'Temperature' has a constructor that accepts a double parameter. 'Sensor' has
Write java program
1. Assume that two classes 'Temperature' and 'Sensor' have been defined. 'Temperature' has a constructor that accepts a double parameter. 'Sensor' has a methodnamed 'getReading' which returns the sensor's current reading (a double). Write a static method 'create' (that could be added to the 'Temperature' class) that accepts a 'Sensor' object. 'create' gets the value of the current reading of the 'Sensor' object, and returns a new 'Temperature' object that is based on this reading.
2.Write the code for invoking a static method named sendTwo, provided by the DataTransmitter class. There are two arguments for this method: a double and an int. Invoke the method with the double value of 15.955 and the int value of 133.
3.Assume the availability of class named Logger that provides a static method, printErrorDescription, that accepts one int argument and returns no value.
Write a statement that invokes the method printErrorDescription, passing it the value 14.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
