Hirdetés

Új hozzászólás Aktív témák

  • Azazello-

    senior tag

    egyelore ez a Concert:

    /**
    * Write a description of class Concert here.
    *
    * @author (your name)
    * @version (a version number or a date)
    */
    public class Concert
    {
    private int year;
    private String location;
    private boolean ticketsLeft;
    //Fields

    public Concert(int y, String l,boolean t){
    year=y;
    location=l;
    ticketsLeft=t;
    }

    public Concert(){
    year=0;
    location="";
    ticketsLeft=false;
    }

    //accessors
    public int getYear(){
    return year;
    }
    public String getLocation(){
    return location;
    }
    public boolean getTicketsLeft(){
    return ticketsLeft;
    }

    //mutators
    public void setYear(int y){
    year =y;
    }
    public void setLocation(String s){
    location = s;
    }
    public void setTicketsLeft(boolean b){
    ticketsLeft = b;
    }

    public void printConcert(){
    System.out.println("Locatio: "+location);
    System.out.println("Year :"+year);
    System.out.println("Tickets Left: "+ticketsLeft);
    }

    }

    es ez az Artist:

    /**
    * Write a description of class Artist here.
    *
    * @author (Oliver Szotyori)
    * @version (01/12/09)
    */
    public class Artist
    {
    // instance variables
    private String firstname;
    private String lastname;
    private int age;
    private Concert nextConcert;

    /**
    * Constructor(s) for objects of class Artist
    */

    public Artist (String fName, String lName, int artistAge, Concert nConcert){
    firstname=fName;
    lastname=lName;
    age=artistAge;
    nextConcert = new Concert();

    }

    public Artist(){
    firstname=null;
    lastname=null;
    age=0;
    nextConcert = new Concert();
    }

    /**
    * accessor methods
    */

    /**
    * mutator methods
    */
    public void printArtist(){
    nextConcert.printConcert();

    }

    }

    hogyan adom hozza, hogy az artist kinyomtassa a concert reszleteit is??

Új hozzászólás Aktív témák