Assignment

Your assignment is to create four properly documented constructs in Java:

  • a BingoCardRowListBasedImpl_LastName class (e.g., BingoCardRowListBasedImpl_Kart), which extends the class BingoCardRowListBased_Abstract class
  • a BingoCardRowSetBasedImpl_LastName class (e.g., BingoCardRowSetBasedImpl_Kart), which extends the class BingoCardRowSetBased_Abstract class
  • a BingoCardColumnListBasedImpl_LastName class (e.g., BingoCardColumnListBasedImpl_Kart), which extends the class BingoCardColumnListBased_Abstract class
  • a BingoCardDiagonalListBasedImpl_LastName class (e.g., BingoCardDiagonalListBasedImpl_Kart), which extends the class BingoCardDiagonalListBased_Abstract class

BingoCard Concept

A BingoCard provides three main services, it can:

  • report on what number is in each row and column
  • mark entries
  • report on whether it contains a certain number
  • report on which numbers are marked
  • report on whether it is in a winning configuration

Note that the BingoCard

  • is told which numbers are on the card in each row and column via a client-facing constructor call
  • always reports that the free space is marked
  • needs to have something added to the precondition for the mark() method

Java Interface

public interface BingoCard {
public static final int ROW_COUNT = 5;
public static final int COLUMN_COUNT = 5;
public static final int FREE_SPACE_ROW = 3;
public static final int FREE_SPACE_COLUMN = 3;
public static final int FREE_SPACE = null;

//part of pre: 1 <= row <= ROW_COUNT
//part of pre: 1 <= column <= COLUMN_COUNT
//part of post: column == 1 ("B") ==> 1 <= rv <= 15
//part of post: column == 2 ("I") ==> 16 <= rv <= 30
//part of post: column == 3 ("N") ==> ((31 <= rv <= 45) || ((row = 3) && (rv == FREE_SPACE)));
//part of post: column == 4 ("G") ==> 46 <= rv <= 60
//part of post: column == 5 ("O") ==> 61 <= rv <= 75
//part of post: rv == FREE_SPACE <==> ((row == FREE_SPACE_ROW) && (column == FREE_SPACE_COLUMN))
public Integer getEntry(int row, int column);

//part of pre: 1 <= number <= 75
//part of post: contains(number) <==> (isMarked(row, column) for some 1 <= row <= ROW_COUNT, 1 <= column <= COLUMN_COUNT)
public void mark(int number);

// pre: true
// part of post: rv == ((getEntry(1, 1) == number) || (getEntry(1, 2) == number) ||
// ... || (getEntry(1, COLUMN_COUNT) == number) ||
// (getEntry(2, 1) == number) || (getEntry(2, 2) == number) ||
// ... || (getEntry(2, COLUMN_COUNT) == number) ||
// ... (getEntry(ROW_COUNT, 1) == number) || (getEntry(ROW_COUNT, 2) == number) ||
// ... || (getEntry(ROW_COUNT, COLUMN_COUNT) == number))
public boolean contains(int number);

//part of pre: 1 <= row <= ROW_COUNT
//part of pre: 1 <= column <= COLUMN_COUNT
public boolean isMarked(int row, int column);

//pre: true
//post: left to student
public boolean isWinner();
}

BingoCardUtils_Skeleton

public class BingoCardUtils_Skeleton
{
public static boolean areEqual(BingoCard bingoCard1, BingoCard bingoCard2)
{
throw new RuntimeException("NOT IMPLEMENTED");
}

//part of pre: rv != null
//part of post: rv != bingoCard
public static BingoCard copy(BingoCard bingoCard)
{
throw new RuntimeException("NOT IMPLEMENTED");
}

//part of pre: bingoCardSet != null
//part of pre: !bingoCardSet.contains(null)
//part of pre: bingoCard in bingoCardSet ==> markCount(bingoCard) == 1
//part of pre: 0 <= bingoCardNumbersNoDuplicates.length <= 75
//part of pre: bingoCardNumbersNoDuplicates doesn't have duplicates
//part of post: rv != null
//part of post: bingoCard in rv ==> markCount(bingoCard) == 1
public static Set< BingoCard> getProjectedWinners(Set< BingoCard> bingoCardSet, int[] bingoCardNumbersNoDuplicates)
{
throw new RuntimeException("NOT IMPLEMENTED");
}
}
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.