Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

how to creat a searching code?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here s my inventory class:

now i want creat a "searchforprice", in order to type a name get its price... ...so what do i need to add in these codes?
 
author
Posts: 23909
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a shot at it first, figuring it out is part of the learning process... We can't give you a hint, if we don't know where you are stuck.

Henry
 
Jose Cisse
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
basically i m trying to make a program for books inventory... ...
and this is my inventory class shown above~~~
as you see, i got some codes for listing book, adding new book, removing.. ...and so on... ...
and now i want to write some codes for searching: when i enter name of book, its price ll be shown... ...
so firstofall, i need to create such searching thing in my inventory class.. ...
 
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think his point was that you should try it yourself, and ask specific questions. Look up linear search and binary search algorithms and try to implement one of those, and if you have specific questions ask. Linear search is easier to start off with. Your question is to general to be able to properly answer it without doing the work for you.


A linear search is very simple. Start at the beggining of the data structure, see if it is what you are looking for, if not move to the next element. Rinse and repeat until you get to the end of the ArrayList.
[ March 22, 2006: Message edited by: Rusty Shackleford ]
 
You showed up just in time for the waffles! And this 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