Here is the program:
import easyIO.*; public class test { // Main method public static void main(String[] args) { In tast = new In(); // Opens keyboard for reading System.out.println("1. Register a bird"); System.out.println("2. Write birdtype"); System.out.println("3. Write place"); System.out.println("4. Close program"); System.out.print("Choose number (1-4:) "); int valg = tast.inInt(); switch (valg) { case 1: registerBird(); break; case 2: writeBirdtype(); break; case 3: writePlace(); break; case 4: System.exit(0); break; default: System.out.println("Error: Choose a number from 1-4"); System.exit(0); } // End of switch statement } // end of main method // registerBird() method public static void registerBird() { In tast = new In(); // Opens keyboard for reading Out birds = new Out("fugler.txt", true); System.out.println("Birds name: "); String fuNavn = tast.inLine(); birds.out(fuNavn); System.out.println("Sex: "); String fuKjonn = tast.inLine(); birds.out(fuKjonn); System.out.println("Place of observation: "); String stObs = tast.inLine(); birds.out(stObs); System.out.println("Date of observation: "); String fuDato = tast.inLine(); birds.out(fuDato); birds.close(); } // end of registerBird() method // writeBirdtype() method public static void writeBirdtype() { In innSkjerm = new In(); // Klargjør innlesing fra terminal In fil = new In("fugler.txt"); // Klargjør innlesing fra fil System.out.println("Write out all the observations of a birdtype: "); String ord = innSkjerm.readLine(); System.out.println("All the observations you asked for:"); String linje = fil.inLine(); } // end of writeBirdType() method } // end of class test
My problem lies in this method:
public static void writeBirdtype() { In innSkjerm = new In(); // Start reading from terminal In fil = new In("fugler.txt"); // Starts reading fromfile System.out.println("Write out all the observations of a birdtype: "); String ord = innSkjerm.readLine(); System.out.println("All the observations you asked for:"); String linje = fil.inLine(); } // end of writeBirdType() method
The problem is when the method asks for "Write out all the observations of a birdtype:" and i type in for example "Craw" then the next line only shows "All the observations you asked for:" without all the observations of Craw.
also the method writePlace() I haven't created that yet, just in case you're wondering
Thanks for help