Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a java code 1. Here is Java code to create a chess piece: public class Chess Piece { public String pieceName; public String position;
write a java code
1. Here is Java code to create a chess piece: public class Chess Piece { public String pieceName; public String position; public ChessPiece (String pieceName, String position) { this.pieceName = pieceName; this.position = position; } } Complete the code by adding one child class for each type of piece. Every type of piece has an attribute containing a description of its allowed movements on the chess board. Also, every type of piece must contain a method that can print the description of its movements. For instance, a message printed to the screen for the rook could be: "Can go in a straight line until it encounters the edge of the board or another piece." 2. Once you are done with #1, call each printing method of every child class in the main method, so that every movements description is printed to the screen. 3. Create a class to represent the solar system. The classes are: CelestialBody Attribute: diameter Star, child of CelestialBody Attributes: heatInCelsius, luminosity Methods: radiate, explode Planet, child of CelestialBody O Attributes: climate, rotation SpeedinDays, revolution SpeedInDays Methods: rotate, revolve o Also, in the main method, instantiate an object to represent the sun, and instantiate an object to represent the EarthStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started