COP 2800  Assignment 6 Solution

Go Dolphins!!!
This assignment is a simulation of beer drinking football fans and the security guards that love them.

Design Requirements:
Class Beer – Tracks whether it is full or empty and has a getter. Also, has a drink method.
Class SixPack – Starts with an array of 6 beers, dispenses beers up to 6, and has a toString.
Class Person – Has a first and last name, getters, and a toString
Class NFLFan – Extends Person, drinks beers and keeps count, getter and toString
Class StadiumSecurity – Extends Person, chews out fans who’ve had more than 2 beers, getter and toString

No output from the class definitions. All the output was done from this driver:

public class Assignment6 {

public static void main (String [] arg) {

SixPack sixPack = new SixPack();

NFLFan steve = new NFLFan("steve", "harris");

NFLFan rick = new NFLFan("rick", "newhouse");

StadiumSecurity bobTheSecurityGuard =

new StadiumSecurity("bob", "modino");

steve.drinkBeer (sixPack.getABeer());



rick.drinkBeer (sixPack.getABeer());

rick.drinkBeer (sixPack.getABeer());

rick.drinkBeer (sixPack.getABeer());



bobTheSecurityGuard.challengeBeerDrinker (steve);

bobTheSecurityGuard.challengeBeerDrinker (rick);




Note: This is not the driver I will use to test your program. I will check for these implementation errors:

· A fan upping his beer count by drinking an empty beer

· A six pack that dispenses more than six beers

· A security guard yelling at a fan who is under the beer limit

· etc
Powered by