• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please Assist - Currency converter Java program  RSS feed

 
Garren Walter
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a project due and I am completely stuck, I have tried many different options. If anyone can assist it would be greatly appreciated



 
Campbell Ritchie
Marshal
Posts: 56598
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I have added code tags, which you should always use, and you can see how much better the post looks
You won't get equals = to compile. I think you meant .equals("Pounds"). I suggest you change that to .equalsIgnoreCase("pounds") which will accept POUNDS pOuNdS etc.
Or even .trim().equalsIgnoreCase("pounds") which will get rid of additional spaces.
If you look at the documentation for Scanner, you find that nextLine doesn't return a char, so that bit won't be the right type and the compiler will complain bitterly. You can look for a method which returns a char, but I don't think you will find one at all. Why not use the equals method with "yes"; ignore case and trim also probably useful.
 
Campbell Ritchie
Marshal
Posts: 56598
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rands = fromKeyboard.nextLine(); ?
No, that bit won't work either. Follow the Scanner link I gave you earlier and you find nextXXX methods, one of which should give the right number type.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!