Java Keyboard Reader: V1.3 to Newest Version

  • Context: Java 
  • Thread starter Thread starter thharrimw
  • Start date Start date
  • Tags Tags
    Java
Click For Summary

Discussion Overview

The discussion revolves around issues related to using a keyboard reader in Java, specifically transitioning from Java version 1.3 to a newer version. Participants are exploring syntax and functionality differences, as well as troubleshooting a basic temperature conversion program.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant mentions difficulty in getting the keyboard reader to work, questioning if the problem lies in using a newer version of Java compared to the book's version (1.3).
  • Another participant suggests using a BufferedReader for input, asking whether the program will be run in a command line or GUI environment.
  • A participant indicates their background in programming on calculators, highlighting their inexperience with Java.
  • One participant offers to review the program code if shared, noting their intermediate experience with Java and C++.
  • The provided code snippet includes a custom class called KeyboardReader, which is not standard in Java, prompting a participant to clarify that the user must also implement this class for the program to work.
  • There is a request for more specific information about any error messages encountered to better diagnose the issue.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the source of the problem, as there are differing views on the necessity of the KeyboardReader class and the implications of using an outdated book. The discussion remains unresolved regarding the exact cause of the issues faced by the original poster.

Contextual Notes

The discussion highlights potential limitations related to the use of outdated resources and the need for additional code (KeyboardReader.java) that may not be provided in the original book.

thharrimw
Messages
114
Reaction score
0
I have recently started to try to teach myself java and i can't get the keybord reader to work.
I'm a book thet's for java V1.3 but I'm using the newest version is that the problem? unless the book was wong then my program syntax should be fine. could anyone tell me what the syntax for the keybord reader is?
 
Technology news on Phys.org
BufferedReader in
= new BufferedReader(new InputStreamReader(System.in));

I believe this is what you need. Are you planning to run your program using the cmd or gui?
 
cmd it's just a basic temp. converting program. I'm not used to jave I've only programmed on my ti 83+, 89T, and Nspier
 
if i copy and past my program could you show me what's wrong? the book that i have is fron 2004 so i don't know if it's syntax is out of date or not.
 
Sure...you could copy and paste it here. I take a look at it. See what's up.

FYI: I'm a intermediate java and c++ programmer.
 
ImputTerminalIO.KeyboardReader
public class converter {
public static void main(String [] args) {
KeyboardReader reader = new KeyboardReader();
double f;
double c;

System.out.print("enter F: ");
f =reader.readDouble();

c = (f-32.0)*5.0/9.0;

System.out.println("The equivalent in c is ");

reader.pause();
}
}
 
that's exactly as it was in my java book.
 
You need to tell us EXACTLY what's happening -- what error messages you're seeing, etc. -- not just "I can't get it to work."

The "KeyboardReader" is not a standard part of the Java programming language. If the KeyboardReader was provided in your book, you need to also type that into a file called "KeyboardReader.java" and compile it along with your own program.

- Warren
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
15K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 4 ·
Replies
4
Views
20K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
17K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
8
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K