Advertisement
Guest User

Jelenleg

a guest
Dec 28th, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.53 KB | None | 0 0
  1. class Szam {
  2.     String eloado;
  3.     String cim;
  4.     int hossz; //masodperc
  5.  
  6. public Szam (String eloado, String cim, int hossz){
  7.    
  8.      try{
  9.         FileInputStream lista = new FileInputStream("lista2.txt");
  10.          DataInputStream in = new DataInputStream(lista);
  11.          BufferedReader br = new BufferedReader(new InputStreamReader(in));
  12.          String strLine;
  13.              while ((strLine = br.readLine()) != null)   {
  14.                 System.out.println (strLine);
  15.                      }
  16.    in.close();
  17.     }catch (Exception e){
  18.   System.err.println("Error: " + e.getMessage());
  19.   }
  20.  }
  21. }
  22.  
  23. public class KissLaszlo_15 {
  24.    
  25. static void a (){
  26. System.out.println ("Add meg a keresendő előadót:");//Blue Stahli; Celldweller; Scandroid; Voicians; I Will Never Be The Same, a lehetséges találatok.
  27. try {
  28. Scanner be = new Scanner(System.in);
  29. String artist = be.nextLine();
  30. FileInputStream fstream = new FileInputStream("lista.txt");
  31. DataInputStream in = new DataInputStream(fstream);
  32. BufferedReader br = new BufferedReader(new InputStreamReader(in));
  33. String strLine;
  34. while ((strLine = br.readLine())!= null) {
  35. CharSequence arg0 = artist;
  36. if (strLine.contains(arg0)) {
  37. System.out.println(strLine);
  38. }
  39. else{System.out.println ("Nincs találat");
  40. }
  41. }
  42. in.close();
  43. } catch (Exception e) {
  44. System.err.println("Error: " + e.getMessage());
  45. }
  46. }
  47.  
  48. static void b (){ //Nincs kész
  49.  
  50. }
  51.    
  52. static void c (){
  53. System.out.println ("Nincs Kész");
  54. }
  55.  
  56. static void d (){
  57. System.out.println ("Nincs Kész");
  58. }
  59.    
  60.  public static void main(String args[]){
  61.    
  62.    
  63.     System.out.println ("Súgó:");
  64.         System.out.println ("A.Feladat: Bekér egy Előadó nevet majd megmutatja, hogy van-e a listán.");
  65.         System.out.println ("B.Feladat: Megnézi, hogy a listán valóban egyre rövidebb dalok szerepelnek-e.");
  66.         System.out.println ("C.Fealdat: A listát végtelenítve megadja a K másodpercnél játszódó zene címét");
  67.         System.out.println ("D.Feladat: Megkeresi az azonos című dalokat és megmondja melyik a leghosszabb.");
  68.        
  69.             Scanner menu = new Scanner(System.in);
  70.             int a = 7;
  71.             System.out.println("(1) A. Feladat");
  72.             System.out.println("(2) B. Feladat");
  73.             System.out.println("(3) C. Feladat");
  74.             System.out.println("(4) D. Feladat");
  75.             System.out.print("Adja meg a valasztott menupontot: ");
  76.             a = menu.nextInt();
  77.             switch(a){
  78.                 case 1 : a(); break;
  79.                 case 2 : b(); break;
  80.                 case 3 : c(); break;
  81.                 case 4 : d(); break;
  82.                 default : System.out.println("Hiba!");}
  83.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement