fatalaa

Untitled

Mar 24th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.51 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. /**
  7.  *
  8.  * @author Tibi
  9.  */
  10. import java.util.Vector;
  11.  
  12. class Zeneszam {
  13.     private String cim;
  14.     private String album;
  15.     private String eloado;
  16.     private String stilus;
  17.     private int idotartam;
  18.    
  19.     public Zeneszam() {
  20.         cim = album = eloado = stilus = "\0";
  21.         idotartam = 0;
  22.     }
  23.    
  24.     public Zeneszam( String cim , String album , String eloado , String stilus
  25.                     , int idotartam ) {
  26.         this.cim = cim;
  27.         this.album = album;
  28.         this.eloado = eloado;
  29.         this.stilus = stilus;
  30.         this.idotartam = idotartam;
  31.     }
  32.  
  33.     public String getAlbum() {
  34.         return album;
  35.     }
  36.  
  37.     public void setAlbum( String album) {
  38.         this.album = album;
  39.     }
  40.  
  41.     public String getCim() {
  42.         return cim;
  43.     }
  44.  
  45.     public void setCim( String cim ) {
  46.         this.cim = cim;
  47.     }
  48.  
  49.     public String getEloado() {
  50.         return eloado;
  51.     }
  52.  
  53.     public void setEloado( String eloado ) {
  54.         this.eloado = eloado;
  55.     }
  56.  
  57.     public int getIdotartam() {
  58.         return idotartam;
  59.     }
  60.  
  61.     public void setIdotartam( int idotartam ) {
  62.         this.idotartam = idotartam;
  63.     }
  64.  
  65.     public String getStilus() {
  66.         return stilus;
  67.     }
  68.  
  69.     public void setStilus( String stilus ) {
  70.         this.stilus = stilus;
  71.     }
  72.  
  73.     @Override
  74.     public String toString() {
  75.         return "Zeneszam{" + "cim=" + cim + ", album=" + album + ", eloado="
  76.                 + eloado + ", stilus=" + stilus + ", idotartam=" + idotartam +
  77.                 '}';
  78.     }
  79.    
  80.    
  81. }
  82.  
  83. public class LejatszasiLista {
  84.     public static Vector<Zeneszam> lista = new Vector<Zeneszam>();
  85.    
  86.     public static void lejatszas( String szamcim ) {
  87.         for( int i = 0; i < lista.size(); i++ ) {
  88.             if( lista.elementAt( i ).getCim().compareToIgnoreCase( szamcim ) == 0 ) {
  89.                 System.out.println( "Lejatszas: " + lista.elementAt( i ).getCim() );
  90.             }
  91.         }
  92.     }
  93.     public static void lejatszas( int num ) {
  94.         if( num >= lista.size() ) {
  95.             System.out.println( "Hiba tortent!" );
  96.             return;
  97.         }
  98.        
  99.         System.out.println("Lejatszas:  " + lista.elementAt( num - 1 ).getCim() );
  100.     }
  101.  
  102.     @Override
  103.     public String toString() {
  104.         return "LejatszasiLista{" + "lista=" + lista + '}';
  105.     }
  106.    
  107.     public static void main( String[] args ) {
  108.         lista.add( new Zeneszam("Paranoid","Paranoid","Black Sabbath","hard rock",250));
  109.         lista.add( new Zeneszam("One in a Million","G N' R Lies","Guns N' Roses","hard rock",609));
  110.         lista.add( new Zeneszam("Smoke on the water","Machine Head","Deep Purple","hard rock",542));
  111.         lista.add( new Zeneszam("Free Bird","Leh nerd Skin nerd","Lynyrd Skynyrd","southern rock",918));
  112.         lista.add( new Zeneszam("Let it Bleed","Let it Bleed","Rolling Stones","rock",528));
  113.         lista.add( new Zeneszam("Black Dog","Led Zeppelin IV","Led Zeppelin","hard rock",456));
  114.         lista.add( new Zeneszam("Roxanne","Outlandos d'Amour","The Police","new wave",312));
  115.         lista.add( new Zeneszam("We Will Rock You","News Of The World","Queen","rock",201));
  116.         lista.add( new Zeneszam("Burn in Hell","Still Hungry","Twisted Sister","heavy metal",537));
  117.         lista.add( new Zeneszam("Help!","Help!","The Beatles","rock",226));
  118.        
  119.         lejatszas( 2 );
  120.        
  121.        
  122.     }
  123. }
Advertisement
Add Comment
Please, Sign In to add comment