Listing 28.14, NineTail.java, presents a solution for the nine tails problem. Revise this program for the 4
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 possible that a solution may not exist for a starting pattern. If so, report that no solution exists.
Data from Listing 28.14
Transcribed Image Text:
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
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 }
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 66% (9 reviews)
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 the full answer
Answered By
Somshukla Chakraborty
I have a teaching experience of more than 4 years by now in diverse subjects like History,Geography,Political Science,Sociology,Business Enterprise,Economics,Environmental Management etc.I teach students from classes 9-12 and undergraduate students.I boards I handle are IB,IGCSE, state boards,ICSE, CBSE.I am passionate about teaching.Full satisfaction of the students is my main goal.
I have completed my graduation and master's in history from Jadavpur University Kolkata,India in 2012 and I have completed my B.Ed from the same University in 2013. I have taught in a reputed school of Kolkata (subjects-History,Geography,Civics,Political Science) from 2014-2016.I worked as a guest lecturer of history in a college of Kolkata for 2 years teaching students of 1st ,2nd and 3rd year. I taught Ancient and Modern Indian history there.I have taught in another school in Mohali,Punjab teaching students from classes 9-12.Presently I am working as an online tutor with concept tutors,Bangalore,India(Carve Niche Pvt.Ltd.) for the last 1year and also have been appointed as an online history tutor by Course Hero(California,U.S) and Vidyalai.com(Chennai,India).
4.00+
2+ Reviews
10+ Question Solved
Related Book For
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
9.36. Consider a simple pendulum of 1-m length (T, = 2s) that has an amplitude of 5 cm. Show that T To If 8, changes by 10%, that is, de 9.37. In the case of a compound pendulum, we showed that when...
-
It is possible that one company might consider an item, such as glue, as one of its direct materials, while another company with identical manufacturing processes might classify the item as one of...
-
Sometimes it is possible that missing data are predictive in the sense that rows with missing data are somehow different from rows without missing data. Check this with the file S02_32.xlsx, which...
-
Determine the void ratio of a soil if its bulk density is 2.06 g/cc and it has a moisture content of 24 percent. The specific gravity of the soil particles is 2.75. Also, determine its dry density...
-
Assume a mother's child has a random location that is uniformly distributed across the 80 foot by 120 foot playground shown in Figure below. a. What is the probability that the child is in the grass?...
-
Popcorn kernels are believed to take between 100 and 200 seconds to pop in a certain micro- wave. (a) Estimate using Method 3 from Table 8.11. (b) What sample size (number of kernels) would be needed...
-
At 3:00 a.m. on November 22, 2010, 16-year-old Sydney McLemore was driving a Mazda3 with her friend, Natalie Hurst, in the front passenger seat. The vehicle was traveling south on Ross Bridge Highway...
-
Huron Company produces a commercial cleaning compound known as Zoom. The direct materials and direct labor standards for one unit of Zoom are given below: During the most recent month, the following...
-
Find the solutions of the equation a cosh x b sinh x = c, assuming that a, b, and c are constants. [Hint: The result should have the form x = f(a,b,c), where f(a, b, c) is a specific function.] =
-
For each information request below, formulate a single SQL query to produce the required information. In each case, you should display only the columns requested. Be sure that your queries do not...
-
The program in Listing 28.14 lets the user enter an input for the nine tails problem from the console and displays the result on the console. Write a program that lets the user set an initial state...
-
Rewrite Programming Exercise 28.14 to enable the user to set an initial pattern of the 4 * 4 16 tails problem (see Figure 28.23a). The user can click the Solve button to display the solution, as...
-
The file Philly contains a sample of 25 neighborhoods in Philadelphia. Variables included are neighborhood population, median sales price of homes in 2012, mean number of days homes were on the...
-
There has been an increase in product variety in our economy. That being said what would your supplier selection strategy look like? Who would be involved? How much detail would be provided? How long...
-
A pilot takes off from an airport and flies due east at a speed of 150 km/h for one hour. Then, to avoid bad weather, they turn towards the north, and notify air traffic control that they have turned...
-
Two children with masses of 50 kg and 70 kg are at rest on frictionless in-line skates. The larger child pushes the smaller so that the smaller child rolls away at a speed of 10 m/s. v=0 m=70 m=70 V...
-
Go towww.sedar.comand download the reports for the two corporations, after a careful search. Your tasks are as follows: Compare and contrast the two reports with regards to the following criteria: 1)...
-
Explain how we can infer the presence of black holes that are in binary systems (with another star orbiting the black hole).
-
A karate student hits downward on a stack of concrete blocks supported at both ends. A block breaks. Explain where it starts to break first, at the bottom or at the top. (The block experiences shear,...
-
In Exercises, find the equation of the tangent line at the given point on each curve. 2y 2 - x = 4; (16, 2)
-
Write a program that displays the calendar for the current month. You can use the Prior and Next buttons to show the calendar of the previous or next month. Display the dates in the current month in...
-
Programming Exercise 15.30 developed a slide show using images. Rewrite that program to develop a slide show using text files. Suppose ten text files named slide0.txt, slide1.txt, . . . , and...
-
Listing 16.4, ComboBoxDemo.java, gives a program that lets the user view a country?s flag image and description by selecting the country from a combo box. The description is a string coded in the...
-
A 3200-3500 word count report, should address the following? Start by explaining what CSR is, and in what ways can it benefit a certain society. Should CSR be grounded on formal law enforcements? Can...
-
This is business law class assignment ! Its not essay! Its legal reasoning response Answers does not have to be super long but not too short either Below are the guidelines...
-
What is the proceeds of a P 6 , 5 0 0 bank discount note that is payable at the end of 6 months but discounted after 3 months at a 1 5 % discount interest rate?
Study smarter with the SolutionInn App