Our users do not want to have to re-enter the price levels each time the app starts. Therefore, we need to save the price levels to a file on disk – called levelsFile - and populate the levelsList with the file’s items when the app starts. Also, every time the user manipulates the values in levelsList, levelsFile needs to be updated accordingly. The easiest way is not to update the file, but to simply override it (create a new file) with the new values in levelsList (each time the user manipulates items in the list). Two new methods need to be created in the PriceChecker class. They are readLevelsFromFile() and writeLevelsToFile(). And then the Main Code Section must also be updated to use these methods in the object. Note: The changes required to the Main Code Section are supplied on the next slide, but you need to complete the skeleton code of the two newly mentioned methods (supplied on subsequent slides). (code to work on)instructions in pictures
Our users do not want to have to re-enter the price levels each time the app starts. Therefore, we need to save the price levels to a file on disk – called levelsFile - and populate the levelsList with the file’s items when the app starts.
Also, every time the user manipulates the values in levelsList, levelsFile needs to be updated accordingly. The easiest way is not to update the file, but to simply override it (create a new file) with the new values in levelsList (each time the user manipulates items in the list).
Two new methods need to be created in the PriceChecker class. They are readLevelsFromFile() and writeLevelsToFile(). And then the Main Code Section must also be updated to use these methods in the object.
Note: The changes required to the Main Code Section are supplied on the next slide, but you need to complete the skeleton code of the two newly mentioned methods (supplied on subsequent slides).
(code to work on)instructions in pictures
Step by step
Solved in 2 steps with 2 images