Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using util.scanner and hashmaps

 
Andrew Concilio
Ranch Hand
Posts: 30
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 48985
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic