What is the purpose of the ReadLine() method? How would you use it with a variable of type string? How would you use it with a variable of type double?

What will be an ideal response?


You use the ReadLine() method to accept user input from the keyboard. This method accepts all of the characters entered by a user until the user presses Enter. The characters can be assigned directly to a string. For example, the following statement accepts a user's input and stores it in the variable myString:
myString = ReadLine();
If you want to use the data as a string-for example, if the input is a word or a name-then you simply use the variable to which you assigned the value. If you want to use the data as a number, then you must use a conversion method to convert the input string to the proper type, as in:
itemPrice = Convert.ToDouble(myString);

Computer Science & Information Technology

You might also like to view...

The decimal number 11 equals B in the ________ number system

Fill in the blank(s) with correct word

Computer Science & Information Technology

It is possible for the DNS server to be attacked, an intrusion called DNS ____.

A. poisoning B. spoofing C. phishing D. cracking

Computer Science & Information Technology

When using Remote Access, if the person who is helping you is also using Windows 8, you can use a method called ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Links to product updates and upgrades are available on the ____ page window.

A. installation B. maintenance C. planning D. resources

Computer Science & Information Technology