I am to create a superclass that has at least two data fields, a constructor and two
other methods. Create two subclasses that inherit from the superclass each
one of which adds at least one more field and at least one more method, one of
which must be an 'over-riding' method. Finally, write an application class that
demonstrates inheritance (creating and using an object from each of the
superclass and subclasses). One of the subclasses objects must use the default
constructor and the other subclass object must use overloading constructor.
I have it started and just about finished(I think) but am unclear if what I am doing is in the right direction.

public class RockBand {

    private String instruments;
    private int members;

    public RockBand() {

        instruments = null;
        members = 0;
    }

    public RockBand(String p_Instruments, int p_Members) {
        this.instruments = p_Instruments;
        this.members = p_Members;
    }

    public void setInstruments(String p_Instruments) {

        instruments = p_Instruments;
    }

    public void setMembers(int p_Members) {

        members = p_Members;
    }

    public String getInstruments() {
        return instruments;
    }

    public int getMembers() {
        return members;
    }
}
public class JazzBandsInstruments extends RockBand {

    private String Jazz;

    public JazzBandsInstruments() {

        Jazz = ("Standing Bass, Drums, Saxaphone");
    }

    @Override
    public void setInstruments(String p_Instruments) {
        super.setInstruments(p_Instruments);
    }

    public String getJazz() {
        return Jazz;
    }

    public void setJazz(String Jazz) {
        this.Jazz = Jazz;
    }
}
public class RockBandsInstruments extends RockBand {

    private String instruments;

    public RockBandsInstruments() {
    }

    public RockBandsInstruments(String p_Instruments, int p_Members) {
        super(p_Instruments, p_Members);
    }

    public void setIntruments(String p_Instruments) {
        instruments = p_Instruments;

    }

    public String getIntruments() {
        return instruments;
    }
}
public class RockersApp {

    public static void main(String[] args) {
        RockBand roc1 = new RockBand();
        roc1.setMembers(4);

        System.out.println("Tha band member count is: " + roc1.getMembers());


        RockBandsInstruments roc2 = new RockBandsInstruments();
        System.out.println("The Rock Bands Instruments are: " + roc2.getIntruments());

        JazzBandsInstruments roc3 = new JazzBandsInstruments();
        System.out.println("The Jazz Bands instruments are: " + roc3.getJazz());

    }
}

Any suggestions, I know it is misses some, but that is why I'm here.
Thanks

For overloading constructor:

private String Jazz;

    public JazzBandsInstruments(String p_Instruments, int p_Members, String p_jazz) {
        super(Instruments, p_Members);
        setJazz(p_jazz)
    }

Apart from that does the code compiles?

Make a list of all the requirements and check your code where they are implemented. If there is something you are not doing then post specific questions.

Then in your main just call the constructors and the methods. I would suggest, since you have more than one constructor per class, to make 2 instances of each object:

JazzBandsInstruments j1 = new JazzBandsInstruments();
j1.set...();
j1.set...();
j1.set...();
// print

JazzBandsInstruments j2 = new JazzBandsInstruments("arg1", arg2, "arg3");
// print
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.