Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Szam {
- String eloado;
- String cim;
- int hossz; //masodperc
- public Szam (String eloado, String cim, int hossz){
- try{
- FileInputStream lista = new FileInputStream("lista2.txt");
- DataInputStream in = new DataInputStream(lista);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- String strLine;
- while ((strLine = br.readLine()) != null) {
- System.out.println (strLine);
- }
- in.close();
- }catch (Exception e){
- System.err.println("Error: " + e.getMessage());
- }
- }
- }
- public class KissLaszlo_15 {
- static void a (){
- 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.
- try {
- Scanner be = new Scanner(System.in);
- String artist = be.nextLine();
- FileInputStream fstream = new FileInputStream("lista.txt");
- DataInputStream in = new DataInputStream(fstream);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- String strLine;
- while ((strLine = br.readLine())!= null) {
- CharSequence arg0 = artist;
- if (strLine.contains(arg0)) {
- System.out.println(strLine);
- }
- else{System.out.println ("Nincs találat");
- }
- }
- in.close();
- } catch (Exception e) {
- System.err.println("Error: " + e.getMessage());
- }
- }
- static void b (){ //Nincs kész
- }
- static void c (){
- System.out.println ("Nincs Kész");
- }
- static void d (){
- System.out.println ("Nincs Kész");
- }
- public static void main(String args[]){
- System.out.println ("Súgó:");
- System.out.println ("A.Feladat: Bekér egy Előadó nevet majd megmutatja, hogy van-e a listán.");
- System.out.println ("B.Feladat: Megnézi, hogy a listán valóban egyre rövidebb dalok szerepelnek-e.");
- System.out.println ("C.Fealdat: A listát végtelenítve megadja a K másodpercnél játszódó zene címét");
- System.out.println ("D.Feladat: Megkeresi az azonos című dalokat és megmondja melyik a leghosszabb.");
- Scanner menu = new Scanner(System.in);
- int a = 7;
- System.out.println("(1) A. Feladat");
- System.out.println("(2) B. Feladat");
- System.out.println("(3) C. Feladat");
- System.out.println("(4) D. Feladat");
- System.out.print("Adja meg a valasztott menupontot: ");
- a = menu.nextInt();
- switch(a){
- case 1 : a(); break;
- case 2 : b(); break;
- case 3 : c(); break;
- case 4 : d(); break;
- default : System.out.println("Hiba!");}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement