Starting from:

$15

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());

System.out.println(steve);

System.out.println(sixPack);



rick.drinkBeer (sixPack.getABeer());

rick.drinkBeer (sixPack.getABeer());

rick.drinkBeer (sixPack.getABeer());

System.out.println(rick);

System.out.println(sixPack);



bobTheSecurityGuard.challengeBeerDrinker (steve);

bobTheSecurityGuard.challengeBeerDrinker (rick);

System.out.println(bobTheSecurityGuard);

}

}



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

More products