Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java code please with @param A) (25 points] Create a class named PieceScooby that implements the following: Note: All properties should be private, all methods

image text in transcribed

Java code please

with @param

A) (25 points] Create a class named PieceScooby that implements the following: Note: All properties should be private, all methods should be public unless stated otherwise. Five fields (attributes/properties) Be sure to put in the appropriate access modifier. (private, public): o symbol for the string representation of the piece (string) O numScoobySnacks to represent number of snacks Scooby currently has o hidden to represent whether the piece is currently hidden or displayed on the board o canMove to represent whether the piece can move o original to represent whether the piece is the original piece from the start of the game A constructor with 5 parameters - that creates a PieceScooby with the attribute values passed to this constructor (in the order listed above) A no parameter constructor (must call the 5 parameter constructor) that creates a default PieceScooby. o symbol property should be set to S o numScoobySnacks should be set to O o hidden should be set to false o canMove should be set to true o original should be set to true Five public accessor methods: o getSymbol - for symbol property o getNumScoobySnacks for numScoobySnacks property o is Hidden - for hidden property o isEntangled for canMove property - the piece is entangled' if it can't move o canSpawn to represent whether the piece can make a copy of itself - only original pieces can make copies Three public mutator methods: o set Symbol - for symbol property o setHidden - for hidden property o entangle - no parameters - set canMove property to false A public mutator method named speak() that has no parameters and no returns. It displays the message "Scooby-Dooby-Doo!" A private mutator method named eatScoobySnack that has no parameters and implements the following: o if the number of Scooby Snacks is greater than 0, then the number decreases by one and the canMove property is set to true A public mutator method named collectScoobySnacks that has one parameter representing the number Scooby Snacks being collected: o if the value is NOT negative - the number of Scooby Snacks is increased by the value passed and eatScoobySnack method is called

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

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions