File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes using util.scanner and hashmaps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "using util.scanner and hashmaps" Watch "using util.scanner and hashmaps" New topic
Author

using util.scanner and hashmaps

Andrew Concilio
Ranch Hand

Joined: Jul 23, 2013
Posts: 30

hi
I was wondering if someone could give me a hand and show me how can I use the util.scanner and hashmaps to assign values to keys get the user type 2 keys and get the return sum of the value of these two keys. for example
A = 1
B = 2
C = 3
D = 4
the user will use util.scanner to type any letter from A to D and the compiled will give him the sum of these letters
your help will be gladlyyyy appreciated.
thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
What are you trying to do? Learn about maps, or do verbal arithmetic? If you want verbal arithmetic, you realise that a char is not a letter, but a number, and you can do arithmetic with it?
If you want to learn about Maps, start here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using util.scanner and hashmaps
 
Similar Threads
Confirmation on HashMap
Writing java objects to XML file
Putting object in HashMap
Removing duplicate keys in HashMap
How can i browse 3 files (same file format, exp: .txt) and process it ?