Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author Tibi
- */
- import java.util.Vector;
- class Zeneszam {
- private String cim;
- private String album;
- private String eloado;
- private String stilus;
- private int idotartam;
- public Zeneszam() {
- cim = album = eloado = stilus = "\0";
- idotartam = 0;
- }
- public Zeneszam( String cim , String album , String eloado , String stilus
- , int idotartam ) {
- this.cim = cim;
- this.album = album;
- this.eloado = eloado;
- this.stilus = stilus;
- this.idotartam = idotartam;
- }
- public String getAlbum() {
- return album;
- }
- public void setAlbum( String album) {
- this.album = album;
- }
- public String getCim() {
- return cim;
- }
- public void setCim( String cim ) {
- this.cim = cim;
- }
- public String getEloado() {
- return eloado;
- }
- public void setEloado( String eloado ) {
- this.eloado = eloado;
- }
- public int getIdotartam() {
- return idotartam;
- }
- public void setIdotartam( int idotartam ) {
- this.idotartam = idotartam;
- }
- public String getStilus() {
- return stilus;
- }
- public void setStilus( String stilus ) {
- this.stilus = stilus;
- }
- @Override
- public String toString() {
- return "Zeneszam{" + "cim=" + cim + ", album=" + album + ", eloado="
- + eloado + ", stilus=" + stilus + ", idotartam=" + idotartam +
- '}';
- }
- }
- public class LejatszasiLista {
- public static Vector<Zeneszam> lista = new Vector<Zeneszam>();
- public static void lejatszas( String szamcim ) {
- for( int i = 0; i < lista.size(); i++ ) {
- if( lista.elementAt( i ).getCim().compareToIgnoreCase( szamcim ) == 0 ) {
- System.out.println( "Lejatszas: " + lista.elementAt( i ).getCim() );
- }
- }
- }
- public static void lejatszas( int num ) {
- if( num >= lista.size() ) {
- System.out.println( "Hiba tortent!" );
- return;
- }
- System.out.println("Lejatszas: " + lista.elementAt( num - 1 ).getCim() );
- }
- @Override
- public String toString() {
- return "LejatszasiLista{" + "lista=" + lista + '}';
- }
- public static void main( String[] args ) {
- lista.add( new Zeneszam("Paranoid","Paranoid","Black Sabbath","hard rock",250));
- lista.add( new Zeneszam("One in a Million","G N' R Lies","Guns N' Roses","hard rock",609));
- lista.add( new Zeneszam("Smoke on the water","Machine Head","Deep Purple","hard rock",542));
- lista.add( new Zeneszam("Free Bird","Leh nerd Skin nerd","Lynyrd Skynyrd","southern rock",918));
- lista.add( new Zeneszam("Let it Bleed","Let it Bleed","Rolling Stones","rock",528));
- lista.add( new Zeneszam("Black Dog","Led Zeppelin IV","Led Zeppelin","hard rock",456));
- lista.add( new Zeneszam("Roxanne","Outlandos d'Amour","The Police","new wave",312));
- lista.add( new Zeneszam("We Will Rock You","News Of The World","Queen","rock",201));
- lista.add( new Zeneszam("Burn in Hell","Still Hungry","Twisted Sister","heavy metal",537));
- lista.add( new Zeneszam("Help!","Help!","The Beatles","rock",226));
- lejatszas( 2 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment