Question: 9.5.6 I'm not sure how to start. Please answer all parts using the given format. Thank you! Exercise 9.5.6: Pies pas Let's Go! For this




Exercise 9.5.6: Pies pas Let's Go! For this exercise, we are going to revisit the superclass that we saw as an example in the last lesson. We have added the pain class, which takes the number of slices and a boolean to indicate is made with canned pumpkin. We also added a sety method in the Pie class For this exercise, you need to create other an Anny or an ArrayList and add 3 pies to the list an ople, and a third type using the dass Aheruditing these to your list, loop through and print out the typesising the method is the ple class Sample Output Ale Meherry 21 MacBook Pro 2 3 5 6 & 7 8 Q E R T Y U 1 P S D F G H J V N C V B N. M 96 command Command Sandbox My Section Practice Status: Not Submitted 9.5.6: Ples Sve SC 1 Import java.util.ArrayList; 2 3 public class Pie Tester FILES 5 6- 2 8 9 ) public static void main(String args) { V/ Start here Pumpkinjava PeTests DP Apple Pleja 1 I QU MacBook Pro * S 2 3 4 5 6 8 Q W E R T T Y U S D F G ock Status: Not Submitted 9.5.6: Pies FILES Duminij Plefester Plava Apple Plejeva 1. public class PumpkinPie extends Pie [ 2 3 private boolean conned; 4 5 public PumpkinPie (int slices, boolean canned) 6 7 super("Pumpkin". slices); 8 this.canned canned; 9 } le 11 public booleon canned 12- 13 return canned; 14 1 15 161 OP MacBook Pro is $ & 7 2 3 % 5 4 6 7 Q W E R. T T U S D F G H Sandbox My Section Practie Status: Not Submitted 9.5.6: Ples Su Can FILES Pumpkin Peleste Das Pusing 1. public class Pie 2 3 private String type: 4 private int slices; 5 6 public Pie (String type, int slices) { 7 this.type - type; 8 this.slices - slices; 9 1 10 11 public int getslices ou 12 return slices: 13 14 15 public void eatstice 16 slices 17 } 18 19 public String getType 20 return type: D Apple Pleje 22 ) OU MacBook Pro 2 3 on * 6 & 7 & W E 20 T Y S D F. G H bandon Section FM Status: Not Submitted 9.5.6: Pies & D III FILES Pumpkin PeTestava Pojave 1. public class ApplePie extends Ple 2 3 public ApplePie (int slices) { 5 Super("Apple, slices); 6 1 7 8 public boolean hasslice 9. C 10 return super getSlices> 0 11 } 12 13 eOverride 14 public void eatslice 15 { 16 if (this.hasslice) 17 18 super catSlice: 19 20 > 21 1 ) MacBook Pro FC S & 2 3 4 5 6 7 Q W E R Y S D F G H
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
