public abstract class Instrument { 
   private String id;
   protected String maker; 
   private static int count = 0;
   
   public Instrument(String maker) 
   {
       count++;
       id = "S" + count;
       this.maker = maker; 
   }
   
   public String getMaker() 
   {
       return maker; 
   }
   
   public String toString()
   {
       return "ID: " + id + ", Maker: " + maker;
   }
    
   abstract public void play(String music);
} 
public class Piano extends Instrument
{
    // instance variables - replace the example below with your own
    private int year;
    /**
     * Constructor for objects of class Piano
     */
    public Piano(int year, String maker)
    {
        // initialise instance variables
        super(maker);
        this.year = year;
        
    }
     /**
     * An example of a method - replace this comment with your own
     *
     * @param  y  a sample parameter for a method
     * @return    the sum of x and y
     */
    public int getyear()
    {
        // put your code here
        return year;
    }
    
    public String toString()
    {
        return super.toString() + " Year: " + year;
    }
    
    
    
    public void play(String music)
    {
        System.out.println("Playing piano: " + music);
    }
    
    
}
so basically I need to create class MusicShop that stores the Instrument objects in an ArrayList named instruments. And then define a method to print out the details of all pianos made by a given maker before a given year.
This is what ive done so far
public class MusicShop
{
    // instance variables - replace the example below with your own
    private ArrayList<Instrument> Instruments;
    
    /**
     * Constructor for objects of class MusicShop
     */
    public MusicShop()
    {
        Instruments = new ArrayList<Instrument>();
    }
    
    public int getTotal() 
    {
        return Instruments.size();
    } 
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y  a sample parameter for a method
     * @return    the sum of x and y
     */
    public void printDetailsOfPiano()
    {
        // put your code here
       
        for(Instrument aInstrument : Instruments) {
             System.out.println(Instruments.getTotal);
        }
    }
}
Not sure how to store objects from abstract class into arraylist and print it details.
 
    