reset password
Author Message
Rayan Hyder
Posts: 15
Posted 13:23 Sep 01, 2019 |

How To ask the user to input something like if the boolean fan is on, the user will input the word true in the console and print it? 

jgarci35
Posts: 8
Posted 13:33 Sep 01, 2019 |

Personally would like a brief description again. I know you have the example and the book exists. But I still want to be sure on the difference myself. 

kknaur
Posts: 540
Posted 14:06 Sep 01, 2019 |

Think of how you would interact with your object.  If you want the user to able to set values of the object you can ask the user a series of questions with their options i.e. for a fan ask them what color they want, speed, etc, and if the object has not been created yet, you can gather all the data into variables and then pass those variables' values into the constructor of the object.  If you want to change the properties of an existing object, you can use the setters to take in a new value and set the new value inside of the object. 

 

Don't forget what you learned in CS2011.  Everything about gathering user input, passing information into methods still is the same, except we structure the code a bit differently using Object Oriented techniques.