In Java Program needs App class that contains your main meth

In Java:

Program needs

-App class that contains:

your main() method

an array of 5 Band objects

A write() method that writes the bands with the top 2 highest scores information to a “good.txt” file

Allowed to Hardcode

-Band class that contains:

A battle() method that randomly assigns a score of 0-20 to each band.

A calc() method that finds the top 2 scores

A grabinfo() method that displays the band’s name, Singer’s name, Home town, Guitar player’s name and a random competition score

Must be encapsulated

Must have a constructor

NOT ALLOWED to hard code

Side information:

Each Band must have-

A singer with a name

A guitar player with a name

A bassist with a name

A drummer with a name

Solution

class TourPromoter {

public String makePosterText(Band band) {

    String guitaristsName = band.getGuitarist().getName();

    String drummersName = band.getDrummer().getName();

    String singersName = band.getSinger().getName();

    StringBuilder posterText = new StringBuilder();

    posterText.append(band.getName()

    posterText.append(\" featuring: \");

    posterText.append(guitaristsName);

    posterText.append(\", \");

    posterText.append(singersName);

    posterText.append(\", \")

    posterText.append(drummersName);

    posterText.append(\", \")

    posterText.append(\"Tickets £50.\");

    return posterText.toString();

}

}

AND

public class Band {

    private Singer singer;

    private Drummer drummer;

    private Guitarist guitarist;

    public String[] getMembers() {

        return {singer.getName(), drummer.getName(), guitarist.getName()};

    }

}

public class TourPromoter {

    public String makePosterText(Band band) {

        StringBuilder posterText = new StringBuilder();

        posterText.append(band.getName());

        posterText.append(\" featuring: \");

        for(String member: band.getMembers()) {

            posterText.append(member);

            posterText.append(\", \");

        }

        posterText.append(\"Tickets: £50\");

        return posterText.toString();

    }   

}

In Java: Program needs -App class that contains: your main() method an array of 5 Band objects A write() method that writes the bands with the top 2 highest sco
In Java: Program needs -App class that contains: your main() method an array of 5 Band objects A write() method that writes the bands with the top 2 highest sco

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site