Form a subclass StateQuarter from the class Coin. A state quarter has a state theme. The toString method should yield a string such as StateQuarter[value=0.25,name=Quarter][state=California] /** A quarter with a state theme. */ public class StateQuarter extends Coin { // Type your code here /** Constructs a state quarter. @param aState the state name */ public StateQuarter(String aState) { super(0.25, "Quarter"); // Type your code here } /** Gets the description of this object. @return a description of this coin */ public String toString() { // Type your code here } }
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Form a subclass StateQuarter from the class Coin. A state quarter has a state theme.
The toString method should yield a string such as
StateQuarter[value=0.25,name=Quarter][state=California]
/**
A quarter with a state theme.
*/
public class StateQuarter extends Coin
{
// Type your code here
/**
Constructs a state quarter.
@param aState the state name
*/
public StateQuarter(String aState)
{
super(0.25, "Quarter");
// Type your code here
}
/**
Gets the description of this object.
@return a description of this coin
*/
public String toString()
{
// Type your code here
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps