Question: Write a class called DoubleCone | (which represents a cone with two scoops of ice cream) which extends the class | cone | (which represents

Write a class called DoubleCone | (which
Write a class called DoubleCone | (which represents a cone with two scoops of ice cream) which extends the class | cone | (which represents a cone witha single scoop of ice cream). You will need to override all public | cone | methods in your subclass. You will also need to create a method that adds toppings to the cone, called aaaTopping . The | tostring | method will need to be adjusted as follows: If you have only one flavor, return a string that says you have this flavor 2x, and if you have two different flavors, return a string that says you have two flavors. Asummary of the | cone and toublecone class methods is shown in the table below. Try to challenge yourself by reusing as much code as possible. Method/Constructor signature | Cone | implementation Doubletone | implementation |Sets the ice cream flavor to || and the | waffle boolean tow |. Cone(String f, beolean wi) Sets both ice cream flavors to|+ and the DoubleCone( String f, boolean w) waffle | boolean to |w. Sets the first ice cream flavor to #1, the GoubleCone(String fl, String f2, boolean w) second to #2, and the waffle boolean to wi. setFlevor(String f) Sets both ice cream flavors to | + . Sets the first ice cream flavor to f1)|, the setFlavor(String fi, String f2) second to | f2. This returns a String representation of the ice cream with the flavor as shown by the four examples below: 1. If you have no topping and waffle is set to true and both flavors are the same \"double waffle cone with vanilla x2" [peruse \"waffle anne vanilla" if waffle 2. If you have no topping and waffle is set to |is true and flavor is vanilla. false, and two different flavors toString!) | i ; ; . |Otherwise, returns "cone with vanilla\" 'double cone with vanilla and chocolate when waffle is false and flavor is vanilla. 3. If you have a topping and waffle is set to false, and both flavors are the same \"double cone with vanilla x2 with mochi> 4. If you have a topping and waffle is set to true, and two different flavors \"double waffle cone with vanilla and chocolate with mochi" You should test your code by running the main method of the runner class. Please do not edit the cone class, and do not add a main method to your DoubleCone.java file or your code will not be scored correctly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!