Stack Data Structure for storing Disk objects

profileSuperClass
 (Not rated)
 (Not rated)
Chat

Using our Stack Data Structure for storing Disk objects (see attached zip file), implement the game The Towers of Hanoi for 3 disks and 3 columns (as simulated at: http://www.mathsisfun.com/games/towerofhanoi.html). Your program should use the Scanner class for asking the user which column they are taking the disk from and which column they are adding the disk to. It should also enforce the rule that a larger disk can not be placed on top of a smaller disk. Your program should detect when the goal is accomplished and display how many moves it took the user to complete.
Given : entire set of codes (Program is already done 70% by the professor). Read the word file and zip folder
Small Self AssessmentQuestionsafter theprogram is completed. This should be completed by the expert who writes the program (This is part of my Assignment question):
1) Which parts of the assignment were you not able to complete fully? For each, explain why you were unable to complete this part and what steps you took to attempt to complete it. Give me as much detail as possible such that I may award partial credit where it is due
2)what would you do differently if you could do this assignment again?
For the idea check the word file
VIDEO LINK OF CLASS LECTURE:
1)https://www.youtube.com/watch?v=PM66kANyNJg
2)https://www.youtube.com/watch?v=8rsh8PKtaFc

Document Preview:

src/Disk.java public class Disk { private int size; public Disk(int size) { this.size = size; } public int getSize() { return this.size; } public String toString() { String answer = ""; for(int i = 0; i < this.size*2; i++) { answer = answer + "="; } return answer; } } src/Driver.javaimport java.util.Random; public class Driver { public static void main(String[] args) throws Exception { TowersOfHanoi toh = new TowersOfHanoi(); toh.display(); } } src/ElasticArray.java public class ElasticArray { private int[] ar; public ElasticArray() { ar = new int[0]; } public void display() { System.out.println("*****"); for(int i = 0; i < ar.length; i++) { System.out.print(ar[i] + " "); } System.out.println(""); } public int length() { return ar.length; } public void add(int val) { System.out.println("Abandoning Old Memory!!!!"); int[] temp = new int[ar.length+1]; for(int i = 0; i < ar.length; i++) { temp[i] = ar[i]; } temp[temp.length-1] = val; ar = temp; } } src/HugeInteger.java public class HugeInteger { private LinkedList theNumber; public HugeInteger(String num) { theNumber = new LinkedList(); for(int i = 0; i < num.length(); i++) { theNumber.addEnd(Integer.parseInt("" + num.charAt(i))); } } public HugeInteger multiply(HugeInteger hi) { try { HugeInteger hiToReturn = new HugeInteger("0"); int carry; int currVal; int currPos1; int currPos2 = hi.theNumber.length()-1; int currNode1; int currNode2; String answer; int padding = 0; while(currPos2 >= 0) { carry = 0; currPos1 = this.theNumber.length()-1; currNode2 = hi.theNumber.get(currPos2).getPayload(); answer = ""; for(int i = 0; i < padding; i++) { answer = answer + "0"; } while(currPos1 >= 0) { currNode1 = this.theNumber.get(currPos1).getPayload(); currVal = (currNode2 * currNode1) + carry; carry =...

  • 10 years ago
Stack Data Structure for storing Disk objects A+ Tutorial use as guide
NOT RATED

Purchase the answer to view it

blurred-text
  • attachment
    stack_data_structure_for_storing_disk_objects_1.txt
  • attachment
    stack_data_structure_for_storing_disk_objects_2.txt
  • attachment
    stack_data_structure_for_storing_disk_objects_3.txt
  • attachment
    stack_data_structure_for_storing_disk_objects_4.txt
  • attachment
    stack_data_structure_for_storing_disk_objects_5.txt
  • attachment
    stack_data_structure_for_storing_disk_objects_6.txt