Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

how to input into array from keyboard

java array

  • Please log in to reply
30 replies to this topic

#25 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 06 December 2010 - 12:14 PM

public void search(String name){
  for(int i=0 ; i<names.length ; i++){
      if( names[i].equals(name) ){
           System.out.println("found " + name + " at index " + i + " with grade " + grade[i]);
      }
  }
}

public void below(){
  System.out.println("The following people have a grade lower than 50");

  for(int i=0 ; i<grades.length ; i++){
      if( grade[i]<50 ){
           System.out.println(names[i] + ": " + grade[i]);
      }
  }
}

Did they teach you about Maps in java yet?
  • 0

#26 atoivan

atoivan

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 73 posts

Posted 06 December 2010 - 12:50 PM

dont u think the search needs and algorithm like in linear search or some thing
  • 0

#27 atoivan

atoivan

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 73 posts

Posted 06 December 2010 - 01:22 PM

we have a problem after the selection of the progarm stops the search do not run why?
  • 0

#28 atoivan

atoivan

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 73 posts

Posted 06 December 2010 - 01:22 PM

and no not yet i
  • 0

#29 atoivan

atoivan

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 73 posts

Posted 06 December 2010 - 01:29 PM

demo.search(name); wat will it be
  • 0

#30 atoivan

atoivan

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 73 posts

Posted 06 December 2010 - 01:46 PM

i do not know maps in java or there is another name for it ;i have solved all
for(int i=0 ; i<names.length ; i++){
      if( names[i].equals(name) ){
           System.out.println("found " + name + " at index " + i + " with grade " + grade[i]);
      }
do not run can u fit it pls
  • 0

#31 atoivan

atoivan

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 73 posts

Posted 07 December 2010 - 04:38 PM

can u help me wit ma sele method what condition do i use when if(a==a) is useless as u say
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download