• Post Reply Bookmark Topic Watch Topic
  • New Topic

Searching a file  RSS feed

 
kevin rousseau
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a ClassroomFile.txt file that contains:
SEC INSTRUCTOR DAYS START END Location BLD/RM CAP Enrolled Available
----------------------------------------------------------------------------------------------------
ACCT 205 001 Osgood,James MWF 09:40 11:30 Main Campus B102A 40 41 0
ACCT 205 002 Osgood,James MWF 11:40 01:30 Main Campus B102A 40 41 0
ACCT 205 004 Osgood,James MWF 01:40 02:30 Main Campus B102A 40 46 0
ACCT 205 005 Novak,Edwin S TR 10:40 11:55 Main Campus B215 40 38 2
ACCT 205 006 Novak,Edwin S TR 09:15 10:30 Main Campus B207 60 55 5
ACCT 205 007 Allen,Mary F TR 12:15 01:30 Main Campus B102A 40 35 5
ACCT 205 008 Stratton,Rona MWF 12:40 01:30 Main Campus B207 40 35 5
ACCT 205 009 Gooden,Eric S TR 10:40 11:55 Main Campus B105 80 54 26
ACCT 512 001 Koeppen,David TR 12:15 01:30 Main Campus B221 37 14 23
ACCT 525 001 Drozda,Robert W 06:00 09:00 Main Campus B102B 25 10 15
ACCT 530 001 Novak,Edwin S TR 01:40 02:55 Main Campus B102A 25 13 12
ACCT 597 001 Krumwiede,Kip TR 09:15 10:30 Main Campus B215 25 7 18
ANTH 101 001 Plew,Mark G TR 07:40 08:55 Main Campus MP211 64 53 11
ANTH 101 070 Klikunas,Leon S 08:00 11:00 Main Campus MP211 50 42 8
ANTH 102 001 Ziker,John MWF 10:40 11:30 Main Campus MP106 94 93 1
ANTH 102 002 Ziker,John TR 01:40 02:55 Main Campus MP211 60 57 3
ANTH 102 003 House,Kendall T 06:00 09:00 Main Campus MP308 49 47 2
ANTH 102 004 McCarl,Robert MWF 09:40 10:30 Main Campus MP201 50 50 0
ANTH 102 005 House,Kendall TR 03:15 04:30 Main Campus MP106 90 69 21
I need to: "find rooms in the College of Business (any room that starts with a 'b', example B202) that are available at a selected time and day during a given semester."
My code so far: (using BlueJ)

so, I CAN pull up my file with this code..., but I don't know how to code the rest, I'm stuck.
I know I need to:
1) gather all the rooms that start with 'b', and place in some sort of container (arraylist, hashmap..)
2) use a tokinizer to 'pull out' only the available rooms.
3) I have read (and re-read and re-read...)
a. The I/O: Reading and Writing (but no 'rithmetic) Lesson of Sun's Java Tutorial
b. Overview of I/O Streams[/URL]
c. many, mamy more references, etc... I have read ALOT, with little understanding
4) I understand the concepts, but not 'how' to code..
a little (lot of) help would be appreciated
Kevin
[ March 29, 2004: Message edited by: kevin rousseau ]
 
Ben Buchli
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you want to read the whole file into a 2-dimensional map container, because you got to use a string index. sort the map with loops so that you dont have any rooms other than starting with b, and dump the rest. then write search methods that let you search thru the map -of course with loops again- according to your other search criteria.
I dont know if that helps or if there are easier ways, but I guess you want to focus on how you get the file content into a container that lets you search for a given value.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!