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

1. Assume that two classes \'Temperature\' and \'Sensor\' have been defined. \'T

ID: 3741963 • Letter: 1

Question

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.Assume the availability of class named DateManager that provides a static method, printTodaysDate, that accepts no arguments and returns no value. Write a statement that calls printTodaysDate.

3.Assume the availability of class named DataTransmitter that provides a static method, sendSignal that takes no arguments. Write the code for invoking this method.

4.Write the code for invoking a static method named sendNumber , provided by the DataTransmitter class. There is one int argument for this method. Invoke this method and use the number 5 as an argument.

5.Write the code for invoking a static method named sendDouble, provided by the DataTransmitter class. There is one double argument for this method.
Assume that a double variable called x has already been declared and initialized to some value. Use this variable's value as an argument in your methodinvocation.

Explanation / Answer

Since you have not provided the language of your preference, I am providing the code in Java.

CODE

==================

import java.util.Date;

class DateManager {

   public static void printTodaysDate () {

       Date today = new Date();

       System.out.println(today);

   }

}

class DataTransmitter {

   public static void sendSignal () {

   }

  

   public static void sendNumber (int num) {

   }

  

   public static void sendDouble (double num) {

   }

}

public class Main

{

   public static void main(String[] args)

   {  

       DateManager.printTodaysDate();

      

       DataTransmitter.sendNumber(5);

       DataTransmitter.sendDouble(x);      

   } // end main()

}