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: 54% (11 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?...
-
E6-18 Determining the Effects of Credit Sales, Sales Discounts, and Sales Returns and Allowances on Income Statement Categories (L04, LO5) Rockland Shoe Company records Sales Returns and Allowances...
-
Go to Coke's Web site [thecoca-colacompany.com], and find five "fun" facts in the material about the company. LO1
-
The following accounts and balances were drawn from the records of Barker Company at December 31, 2018: Required Use the accounts and balances from Barker Company to construct an income statement,...
-
Note: Where applicable, use the present value tables provided in APPENDICES 1 and 2 that appear after QUESTION 5 . REQUIRED Use the information provided below to answer the following questions: 5 . 1...
-
A circle, C, has equation x 2 + y 2 16x 36 = 0. a. Find the coordinates of the centre of the circle. b. Find the radius of the circle. c. Find the coordinates of the points where the circle meets...
-
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...
-
Repeat Prob. 349 for a gage pressure of 45 kPa. Data from Problem 49 The gage pressure of the air in the tank shown in Fig. P349 is measured to be 65 kPa. Determine the differential height h of the...
-
Based on the expense information below how do I figure out the break even, total fixed costs, total income for each procedure, variable costs dependent upon volume? The organization is purchasing a...
-
Compare training formats. Do you personally prefer classroom training, small group sessions, one-to-one training, or self-guided tutorials? Why? Are there circumstances in which you feel a one-to-one...
-
what ways do you feel a sense of identity and belonging within the organization's community, and how does that influence your performance and engagement?
-
How do different generational cohorts within the workforce perceive and contribute to organizational culture, and what steps can organizations take to create a cohesive culture that bridges...
-
How do various tools and techniques such as adding slack (padding estimates) or project buffers help project managers perform duration estimates? What are some ethical considerations when using slack...
-
Form teams of three students. Each team must choose a firm in the PC manufacturing industry and then go to the Web site of the firm and acquire as much competitive intelligence as possible. Each team...
-
Graph one period of each function. y = 4 cos x
-
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...
-
20 On January 1, Year 1, X Company purchased equipment for $80,000. The company estimates that the equipment will have a useful life of 10 years and a residual value of $5,000. X Company depreciates...
-
Discuss why it is important for company managers to understand and use social capital knowledge to help build social ties among their skilled knowledge workers so they can build employee loyalty...
-
Kate lives in a house close to a local university, and she traditionally has rented a garage apartment in the back of her property to students for $750 per month. Kate wants to transfer the title to...
Study smarter with the SolutionInn App