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

PLEASE READ BEFORE ANSWERING: I have posted this a few times already, with the s

ID: 3576704 • Letter: P

Question

PLEASE READ BEFORE ANSWERING: I have posted this a few times already, with the specification it passes in the following, linked compiler (which I will provide below). Each answer I have gotten fails to pass. The two "Actual" fields return as "java.lang.IllegalArgumentException" and two "Expected" fields return as null. This code MUST pass in this EXACT compiler and no other:

http://codecheck.it/codecheck/files?repo=jfe1cc&problem=ch09/c09_exp_9_102

AGAIN NOTE: Do not post results from ANY other compiler, and do NOT post before you are CERTAIN it passes in the EXACT compiler (which is the ONLY compiler which I need results form). And PLEASE post a SCREENSHOT of the PASSING OUTPUT from this specified compiler as evidence.

Also, PLEASE take note of the following:
-Post the PASSING CODE (not output) as text, not as an image.
-Avoid making alterations to the original code unless necessary.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

(image included in link above)

The getDescription method should yield a string such as

Complete the following code:

The following classes are used to check your work:

Explanation / Answer

/**
* A coin with a monetary value.
*/
public class Coin {
   private double value;
   private String name;

   /**
   * Constructs a coin.
   *
   * @param aValue
   * the monetary value of the coin.
   * @param aName
   * the name of the coin
   */
   public Coin(double aValue, String aName) {
       value = aValue;
       name = aName;
   }

   /**
   * Gets the coin value.
   *
   * @return the value
   */
   public double getValue() {
       return value;
   }

   /**
   * Gets the coin description.
   *
   * @return a description of this coin
   */
   public String getDescription() {
       return "value=" + value + ", state= " + name;
   }
}

/**
* A quarter with a state theme.
*/
public class Quarter extends Coin {
   // your work here

   /**
   * Constructs a quarter.
   *
   * @param aValue
   * the monetary value of the quarter.
   * @param aName
   * the name of the quarter
   */
   public Quarter(String aState) {
       // your work here
       super(.25, aState);
   }

   public String getDescription() {
       return super.getDescription();
       // your work here
   }
}

public class QuarterTester {
   public static void main(String[] args) {
       Coin c = new Quarter("Michigan");
       System.out.println(c.getDescription());
       System.out.println("Expected: Quarter, value=0.25, state=Michigan");
   }
}

OUTPUT:

value=0.25, state= Michigan
Expected: Quarter, value=0.25, state=Michigan

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