Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Using BufferedReader or JOptionPane to ask 3 numbers from the user

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using BufferedReader or JOptionPane, ask for 10 numbers from the user. Use an array to
store  the  values  of  these  10 numbers.  Output  on  the  screen  the  number  with  the
greatest value.
 
Rancher
Posts: 495
7
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tell The Details
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:Tell The Details



Ask for user input, and then sort them.
 
Marshal
Posts: 70672
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I would use neither an option pane nor a buffered reader. I would use a Scanner. Actually, I would wrap the Scanner instance in a utility class, but that may be something you can only do with a bit of experience. Look at this link.
If you get problems with nextLine() after nextAnythingElse() be sure to ask for help here.
 
Campbell Ritchie
Marshal
Posts: 70672
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can identify the largest and the smallest of ten numbers without having to store them in any sort of data structure. But get the keyboard input working first.By the way: don't create lots of Scanner objects reading from System.in. You need one such Scanner which you use for the whole application if possible. That technique is not thread‑safe.
 
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic