Question: Listing 28.14, NineTail.java, presents a solution for the nine tails problem. Revise this program for the 4 * 4 16 tails problem. Note it is

Listing 28.14, NineTail.java, presents a solution for the nine tails problem. Revise this program for the 4 * 4 16 tails problem. Note it is possible that a solution may not exist for a starting pattern. If so, report that no solution exists.


Data from Listing 28.14

1mport java. util.Scanner;: 2 3 publ1c class NineTail { publ1c stat1c void

1mport java. util.Scanner;: 2 3 publ1c class NineTail { publ1c stat1c void main (String[] args) { /I Prompt the user to enter nine coins' Hs and Ts System.out.print ("Enter the 1nitial nine coins Hs and Ts: "); Scanner input = new Scanner (System.in): String s = input.nextline (); char [] initial Node - s. toCharArray (): 4 5 6 7 8 9 10 NineTailModel model = new NineTailModel (): java.util.List path = model. getShortestPath (NineTai 1 Model.getIndex (initialNode)) : 11 12 13 14 15 System.out.println("The steps to f11p the co1ns are "): for (1nt i = 0: i < path.size(): i++) NineTail Model.printNode ( NineTail Model.getNode (path.get (i).intValue ())): 16 17 18 19 20 }

Step by Step Solution

3.40 Rating (172 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javaioSerializable import javautilArrayList import javautilList import javautilScanner public class Exercise2813 public static void mainString args Prompt the user to enter 16 coins H and Ts Sy... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction to Java Programming and Data Structure Questions!