// DrJava saved history v2 // Testing the pizza class we created // create a pizza Pizza annsPizza = new Pizza("small", 5); // display the pizza toppings (currently none) annsPizza.toString() // add some toppings and check that they were added (with toString) annsPizza.addTopping("pepperoni") annsPizza.toString() annsPizza.addTopping("black olives") annsPizza.addTopping("extreme cheese") annsPizza.addTopping("mushrooms") annsPizza.addTopping("ketchup") // yuck! annsPizza.addTopping("artichokes") annsPizza.toString() // we then added removeTopping method and created our pizza again Pizza annsPizza = new Pizza("small", 5); // added some toppings annsPizza.addTopping("black olives") annsPizza.addTopping("extreme cheese") annsPizza.addTopping("mushrooms") annsPizza.addTopping("pepperoni") annsPizza.addTopping("ketchup") // checked that they were there annsPizza.toString() // removed one annsPizza.removeTopping("pepperoni") // checked that it was actually removed annsPizza.toString() // put it back annsPizza.addTopping("pepperoni") // in our first try at removeTopping, we forgot to decrement the topping count // so we had to fix our code and try again. Pizza annsPizza = new Pizza("small", 5); annsPizza.addTopping("black olives") annsPizza.addTopping("ketchup") annsPizza.addTopping("pepperoni") annsPizza.addTopping("mushrooms") annsPizza.addTopping("extreme cheese") annsPizza.toString() // this time we HAD to get rid of that ketchup from our pizza annsPizza.removeTopping("ketchup") // check that it was finally gone! annsPizza.toString() // now check our TicTacToe game TicTacToe game = new TicTacToe(); // look at the game board layout. game.toString() // the quotes cause it to look misaligned so we use the print() // method to produce a cleaner-looking printout. System.out.print(game.toString()) // now we play Angie vs. Faisal Angie is player 1 game.setMark(1,1,'X') System.out.print(game.toString()) game.setMark(0,0,'O') System.out.print(game.toString()) game.setMark(0,2,'X') System.out.print(game.toString()) game.setMark(2,0,'O') System.out.print(game.toString()) game.setMark(1,0,'X') System.out.print(game.toString()) game.setMark(1,2,'O') System.out.print(game.toString()) // its a draw! // next week - we will make our game more user friendly! // Think of things that you would like to add