This commit is contained in:
Harald Mueller 2021-12-16 09:27:55 +01:00
parent 3ba49a5507
commit 6995c5d23b

View File

@ -67,20 +67,20 @@ It should implement the following methods and define the following fields:
6) **_Implementation:_** 6) **_Implementation:_**
**--> ** Implement 2 concrete classes for two models of the abstract class you specified in task 5. ** --> ** Implement 2 concrete classes for two models of the abstract class you specified in task 5.
7) **_Using polymorphism:_** 7) **_Using polymorphism:_**
**--> ** Now write a class CsvWriter that reads readings from one of these sensors at a given time interval and writes them to a file. (File name, interval and sensor should be configurable). ** --> ** Now write a class CsvWriter that reads readings from one of these sensors at a given time interval and writes them to a file. (File name, interval and sensor should be configurable).
- Tip: Create an object of a child class of Sensor and pass it to the constructor of CsvWriter as a parameter together with the interval and the filename. - Tip: Create an object of a child class of Sensor and pass it to the constructor of CsvWriter as a parameter together with the interval and the filename.
File format: each line is Comma Separated Value (CSV) i.e. something like _time stamp_,_name of sensor_,_unit_,_measurement_. Each line corresponds to one measurement. File format: each line is Comma Separated Value (CSV) i.e. something like _time stamp_,_name of sensor_,_unit_,_measurement_. Each line corresponds to one measurement.
- Implement a method "public void run()" which you then call to actually take the measurements and write them to the file. - Implement a method "public void run()" which you then call to actually take the measurements and write them to the file.
8) **--> ** **_Create the CsvWriter in a main class_** and allow the user to select the sensor, the interval and the file name. 8) ** --> ** **_Create the CsvWriter in a main class_** and allow the user to select the sensor, the interval and the file name.
9) **--> ** **_Optional:_** Think about how you would write the same data into a database. 9) ** --> ** **_Optional:_** Think about how you would write the same data into a database or into a .json format file.