• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Array Help

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to use the JOptionPane and a while loop to input two lists ( so two arrays?) of 32 numbers, which are made up by the user. The data cannot be sorted before it is entered into the arrays. It is supposed to ignore the numbers -1000 and 1000. I need to be able to print the average high and average low of the numbers and lows or highs position in order with the day( the index of the array?). I'm new at this so any help is appreciated. Here's what I have so far.





 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to break your problem down into very small pieces, and tackle the pieces one at a time. If you get stuck on one of the pieces, post what you tried so far and TellTheDetails(←click) about what in particular is giving you trouble.
 
Jefferey Stevens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I'm not sure how to use JOptionPane to input two lists of 32 numbers in the Load method. I don't know how to start.

 
Sheriff
Posts: 27235
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, again breaking that task down into smaller pieces, would that mean that you don't know how to use a JOptionPane to input something? Or is it the inputting of a number that's giving you the problem? Or inputting 32 numbers?
 
Jefferey Stevens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:So, again breaking that task down into smaller pieces, would that mean that you don't know how to use a JOptionPane to input something? Or is it the inputting of a number that's giving you the problem? Or inputting 32 numbers?



All of it :[

JOptionPane.showInputDialogue?
I really have no idea how to go about it.
 
Greenhorn
Posts: 27
Notepad
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First in Init method you initialize i with 1 , please initialize it with 0 . . .
Secondly JOptionPane only give and take String
like
String input = JOPtionPane.showInputDialog("Enter String");

JOptionPane.showMessageDialog(null , "input");

if you use input string as a integer yoy should use parsing ,,.. like int in = Integer.parseInt(input);

moreover you use java documentations for more help
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic