PDA

View Full Version : I need to use the cs1 package (keyboard class)



crazychristian
December 3rd, 2009, 02:53 AM
Hello, I am using NetBeans 6.7.1 and I need to use the keyboard class. I have tried to get it working, but I have no idea what to do really. So can anyone guide me real quick to how to get it running? (I already have the package downloaded I just need to get NetBeans to access it somehow).

Thanks :)

fiddler616
December 3rd, 2009, 03:57 AM
Hello, I am using NetBeans 6.7.1 and I need to use the keyboard class. I have tried to get it working, but I have no idea what to do really. So can anyone guide me real quick to how to get it running? (I already have the package downloaded I just need to get NetBeans to access it somehow).

Thanks :)
Could we have some more information, please? What language is this--Java? Where did you hear about a "keyboard class?" What do you want the class to accomplish?

crazychristian
December 3rd, 2009, 04:04 AM
Could we have some more information, please? What language is this--Java? Where did you hear about a "keyboard class?" What do you want the class to accomplish?

I am writing in Java. We used this package in school... and it would read the users input.

I.e


import cs1.Keyboard;
public class X
{
public static void main(String [] args)
{
System.out.println("Please enter a value");
double a=Keyboard.readDouble();
}
}

So the person would type a value, and would be stored for the double a. Does this help?

fiddler616
December 3rd, 2009, 04:12 AM
I am writing in Java. We used this package in school... and it would read the users input.

I.e


import cs1.Keyboard;
public class X
{
public static void main(String [] args)
{
System.out.println("Please enter a value");
double a=Keyboard.readDouble();
}
}

So the person would type a value, and would be stored for the double a. Does this help?
Mmf, it's been a while since I had to load third-party libraries in Java, but this (http://faculty.ed.umuc.edu/~arnoldyl/NetBeansTutorials/Predefined-Classes.html) should help.

As a sidenote, once you get out of that class you might be interested in the Scanner (http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html) class which does all the same stuff as Keyboard, but is built into the Java language.

crazychristian
December 3rd, 2009, 04:31 AM
Thank you :) That pointed me in the right direction.

fiddler616
December 3rd, 2009, 04:34 AM
Thank you :) That pointed me in the right direction.
No problem, I'm glad I could help.

(PS: Don't forget to mark the thread as solved!)