Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is for java Create and develop the Cell class. It's an abstract class from which all Cell types will be extended. It must have

  • This is for java

    Create and develop the Cell class.

    • It's an abstract class from which all Cell types will be extended.

    • It must have a String type.

    • It'll need to remember if the Cell is exposed or not.

    • It'll need to remember any marks the player has placed on the Cell.

    • We should define three public static constants for the marks.

      • flag denotes when the Cell has been "flagged" that the player is very confident that a bomb resides in the Cell. We'll use "X" for its value.

      • mark denotes when the Cell has been "marked" that the player suspects that a bomb might reside in the Cell. We'll use "?" for its value.

      • unmark denotes when the Cell has no mark. We'll use "-" for its value.

    • It's constructor will

      • initialize its type from its parameter,

      • initialize the Cell to not exposed, and

      • initialize its mark such that it's not marked.

    • It has a getType() accessor method that returns the type of the Cell as follows.

      • If the Cell is exposed, return the value of the type field.

      • If the Cell is not exposed and it is flagged or marked, return the value of the mark.

      • If the Cell is not exposed and not marked, return the value for an unmarked Cell.

    • It has an expose() mutator method that sets the Cell to exposed.

    • It has a flag() mutator method that marks the Cell as "flagged".

    • It has a mark() mutator method that marks the Cell as "marked".

    • It has a clearMark() mutator method that unmarks the Cell.

    • It has a getExposed() accessor method that returns whether the Cell is exposed or not.

    • It has a toString() method that returns a String in the standard format of the name of the class (do not "hardcode" this) followed by [type=ourType] where ourType is the type used to instantiate the object. For more information see section 5.2.5 in the textbook.

    • It has a main() method that performs a "unit test" of this class. It should make sure that, for each subclass of Cell, each method changes the Cell's state properly and returns the correct information. Use concepts we used in the review project.

  • Create and develop the Empty class.

    • It extends the Cell class.

    • It has a public static constant named myType of "empty".

    • It has a main() method that performs a "unit test" of this class. It should make sure that its type is correct after being instantiated.

  • Create and develop the Bomb class.

    • It extends the Cell class.

    • It has a public static constant named myType of "bomb".

    • It has a main() method that performs a "unit test" of this class. It should make sure that its type is correct after being instantiated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Identify the major criticisms of neurofinance research.

Answered: 1 week ago