Answered step by step
Verified Expert Solution
Link Copied!

Question

...
1 Approved Answer

.class public tofhanoi .super java/lang/Object .method public static main([Ljava/lang/String;)V .limit stack 3 .limit locals 1 getstatic java/lang/System/out Ljava/io/PrintStream; ldc D invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V getstatic java/lang/System/out

.class public tofhanoi .super java/lang/Object

.method public static main([Ljava/lang/String;)V .limit stack 3 .limit locals 1

getstatic java/lang/System/out Ljava/io/PrintStream; ldc " D" invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc " CCC" invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc " BBBBB" invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc " AAAAAAA _______ _______" invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc " | | |" invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc " 1 2 3 " invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V

return

.end method

I need help in adding the following to my program

-The last part did not require you to check how many characters the user enters. What if the user just presses "enter"? What if the user enters only one number? What if the user enters more than two numbers? Add this functionality to this part, along with appropriate responses, such as "expecting a second peg number in the input". -Additionally, the last part had you print the initial state of the puzzle, but it did not move the pieces, so your program did not have to have an internal representation of the puzzle. You will need to include this now. -Also, you will need to check to see if the move is valid, such as placing a ring onto a larger one, but not allowing a ring to be placed onto a smaller one. -Initially, tell the user what the goal of the game is, and briefly describe how to play it. -If the user solves the puzzle, that is, gets all rings on peg 3, your program should print a message and quit. -Utilize arrays in your solution. -Include at least one other method besides the init and main methods.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Basic Statistics

Authors: Charles Henry Brase, Corrinne Pellillo Brase

6th Edition

9781111827021

Students also viewed these Programming questions