public class Coin { //instance vars private double value; private String name; private int year; public Coin() { this("DIME"); } public Coin(String name) { this(name,2024); } public Coin(String name, int year) { this.name = name.toUpperCase(); this.year = year; this.value = getValue(); } public double getValue() { switch (name.toUpperCase()) { case "DIME": value = 0.10; break; case "QUARTER" : value = 0.25; break; case "NICKEL" : value = 0.05; break; default: value = 0.00; } return value; } public String getName() { return name; } public int getYear() { return year; } public String toString() { return String.format("%.2f",getValue()); } }