Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Keyboard Scanner made easy!
Index -> Programming, Java -> Java Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jeffgreco13




PostPosted: Tue Sep 16, 2008 10:55 am   Post subject: Keyboard Scanner made easy!

Here's the Keyboard Scanner function made into an object. Very, very simple to use...

code:

...
variable1 = reader1.readDouble();  // Reads a double value and assigns it to variable1
variable2 = reader1.readInt();  // Reads an integer
variable3 = reader1.readBoolean();  // Reads boolean value, True or False
variable4 = reader1.readChar();  // Reads a Character value, ASCII
variable5 = reader1.readDoubleLine();  // Reads double values on one line, returns an array of values separated by whitespace
variable6 = reader1.readIntLine();  // Reads integer values on one line, returns array of values separated by whitespace
variable7 = reader1.readCharLine();  // Same with character values, ASCII
variable8 = reader1.readString();  // Reads a string
...


So many more constructors can be added to modify the input before it is returned, the possibilities are endless.



reader1.java
 Description:

Download
 Filename:  reader1.java
 Filesize:  8.55 KB
 Downloaded:  229 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Sep 16, 2008 11:17 am   Post subject: RE:Keyboard Scanner made easy!

I thought a Scanner was already an Object, no?

http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
jeffgreco13




PostPosted: Tue Sep 16, 2008 5:33 pm   Post subject: Re: Keyboard Scanner made easy!

ok... shortcut then.. thats what this is
Euphoracle




PostPosted: Tue Sep 16, 2008 9:38 pm   Post subject: RE:Keyboard Scanner made easy!

Shortcut to what? It's an alias, essentially.
Display posts from previous:   
   Index -> Programming, Java -> Java Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: