Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Form a subclass StateQuarter from the class Coin. A state quarter has a state th

ID: 669950 • Letter: F

Question

Form a subclass StateQuarter from the class Coin. A state quarter has a state theme.

The toString method should yield a string such as

Use the following files:

Coin.java

QuarterTester.java

Complete the following file:

StateQuarter.java

(the . . . is where new code needs to go)

/**

A quarter with a state theme.

s*/

public class StateQuarter extends Coin

{

// your work here

/**

Constructs a state quarter.

@param aState the state name

*/

public StateQuarter(String aState)

{

super(0.25, "Quarter");

// your work here

}

/**

Gets the description of this object.

@return a description of this coin

*/

public String toString()

{

// your work here

}

}

Explanation / Answer

/**
A quarter with a state theme.
s*/
public class StateQuarter extends Coin
{
String stateName;

/**
Constructs a state quarter.
@param aState the state name
*/
public StateQuarter(String aState)
{
super(0.25, "Quarter");
stateName=aState;
}

/**
Gets the description of this object.
@return a description of this coin
*/
public String toString()
{
return super.toString()+"[state="+stateName+"]";
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote