Advertisement
Guest User

??

a guest
Jan 19th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. import java.io.File;
  2.  
  3. import java.io.FileNotFoundException;
  4. import java.util.ArrayList;
  5. import java.util.List;
  6. import java.util.Scanner;
  7.  
  8. //Zaimplementuj kod do wczytywania listy drinków z pliku barmanX.txt z folderu resource
  9. //oraz listę składnikow z pliku ingridients.txt
  10. public class FileService {
  11.     static List<Drink> readDrinkListFromFile(String file) throws FileNotFoundException {
  12.  
  13.         File file1 = new File("C:\\Fizzbuzz\\src\\resource\\barman1.txt");
  14.         Scanner in1 = new Scanner(file1);
  15.  
  16.    /*     while(in1.hasNext()) {
  17.             System.out.println(in1.nextLine());
  18.         } */
  19.  
  20.  
  21.         File file2 = new File("C:\\Fizzbuzz\\src\\resource\\barman2.txt");
  22.         Scanner in2 = new Scanner(file2);
  23.  
  24.         while(in2.hasNext()) {
  25.             System.out.println(in2.nextLine());
  26.         }
  27.  
  28.         // Jak zaimplementowac txt tak zeby pokazywaly sie nazwy drinkow tylko, ale zeby pobrane bylo wszystko ?
  29.         return new ArrayList();
  30.  
  31.     }
  32.  
  33.     static List<Drink> readIngridientListFromFile(String file) throws FileNotFoundException {
  34.  
  35.         File file3 = new File("C:\\Fizzbuzz\\src\\resource\\ingridients.txt");
  36.         Scanner in3 = new Scanner(file3);
  37.  
  38.          while(in3.hasNext()) {
  39.             System.out.println(in3.nextLine());
  40.         }
  41.  
  42.         return new ArrayList();
  43.     };
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement