hi, after hours of staring at my computer screen, and browsing through various internet forums i am totally stuck!
I have created the following array which reads from an input file the following list of book titles followed by author then book title author etc
Concurrent programming ---- book title
C. R. Snow ---- author
Pascal Precisely ----book title
Judy Bishop ---- author etc
THINKING RECURSIVELY WITH JAVA
ERIC ROBERTS
Concurrent Programming
Stephen J. Hartley
Java Gently
Judith Bishop
Petri Nets
Wolfgang Reisig
Finite Transition Systems
Andre Arnold
Data Structures and Problem Solving Using Java
mark allen weiss
this is the array i have created which reads from the input file
int row, col;
String [] [] matrix = new String [numberOfBooks] [2]
for (row=0; row<matrix.leng th; row++)
{
for (col=0; col<matrix[row].length; col++)
matrix[row] [col] = inFile.nextLine ();
}
when using the following piece of code i am able to print the array
for (row=0; row<matrix.leng th; row++)
{
for (col=0; col<matrix[row].length; col++)
outFile.print(m atrix[row] [col].toUpperCase() + System.getPrope rty("line.separ ator"));
outFile.println ();
}
when using this code the array is printed as follows which is book title followed by author
CONCURRENT PROGRAMMING
C. R. SNOW
PASCAL PRECISELY
JUDY BISHOP
THINKING RECURSIVELY WITH JAVA
ERIC ROBERTS
CONCURRENT PROGRAMMING
STEPHEN J. HARTLEY
JAVA GENTLY
JUDITH BISHOP
PETRI NETS
WOLFGANG REISIG
FINITE TRANSITION SYSTEMS
ANDRE ARNOLD
DATA STRUCTURES AND PROBLEM SOLVING USING JAVA
MARK ALLEN WEISS
i am now very stuck i need to be able to allow the user to enter the authors surname and then the program will display all books by this author to the outfile (there may be more than one book by the author)
i have started with the following
String AuthorSurname;
System.out.prin tln("please enter an author's surname to view available books"); AuthorSurname = Keyboard.next() ;
i now need some sort of code which will allow me to display all the books by a particular author.
i very much appreciate any help,
thanks
I have created the following array which reads from an input file the following list of book titles followed by author then book title author etc
Concurrent programming ---- book title
C. R. Snow ---- author
Pascal Precisely ----book title
Judy Bishop ---- author etc
THINKING RECURSIVELY WITH JAVA
ERIC ROBERTS
Concurrent Programming
Stephen J. Hartley
Java Gently
Judith Bishop
Petri Nets
Wolfgang Reisig
Finite Transition Systems
Andre Arnold
Data Structures and Problem Solving Using Java
mark allen weiss
this is the array i have created which reads from the input file
int row, col;
String [] [] matrix = new String [numberOfBooks] [2]
for (row=0; row<matrix.leng th; row++)
{
for (col=0; col<matrix[row].length; col++)
matrix[row] [col] = inFile.nextLine ();
}
when using the following piece of code i am able to print the array
for (row=0; row<matrix.leng th; row++)
{
for (col=0; col<matrix[row].length; col++)
outFile.print(m atrix[row] [col].toUpperCase() + System.getPrope rty("line.separ ator"));
outFile.println ();
}
when using this code the array is printed as follows which is book title followed by author
CONCURRENT PROGRAMMING
C. R. SNOW
PASCAL PRECISELY
JUDY BISHOP
THINKING RECURSIVELY WITH JAVA
ERIC ROBERTS
CONCURRENT PROGRAMMING
STEPHEN J. HARTLEY
JAVA GENTLY
JUDITH BISHOP
PETRI NETS
WOLFGANG REISIG
FINITE TRANSITION SYSTEMS
ANDRE ARNOLD
DATA STRUCTURES AND PROBLEM SOLVING USING JAVA
MARK ALLEN WEISS
i am now very stuck i need to be able to allow the user to enter the authors surname and then the program will display all books by this author to the outfile (there may be more than one book by the author)
i have started with the following
String AuthorSurname;
System.out.prin tln("please enter an author's surname to view available books"); AuthorSurname = Keyboard.next() ;
i now need some sort of code which will allow me to display all the books by a particular author.
i very much appreciate any help,
thanks
Comment