Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Help writing scanner code

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to write a simple code for money spent at a car wash and i keep getting a RED X on the formula line


 
Rancher
Posts: 133
7
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for formatting the code properly, it makes life so much easier.

Anyway, you are reading the name a few times but not the trips or the washPrice, careful when copying and pasting
 
Marshal
Posts: 67464
257
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Beware of nextLine(); it doesn't always give you what you want. If you want something different, use a different method. In this case, you want an int:-...and similar.

Ask here before you call nextLine() after a call to nextAnythingElse().
 
Saloon Keeper
Posts: 6767
64
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
Nothing? Or something? Like this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!