Question
Java !!!!!!!!!!!! Ice Cream Constructor & Getters/Setters Complete the code for the class IceCream. You have to implement all the accessor and mutator (getter/setter) methods
Java !!!!!!!!!!!!
Ice Cream Constructor & Getters/Setters
Complete the code for the class IceCream. You have to implement all the accessor and mutator (getter/setter) methods for each of these 2 attributes, as well as its constructor: - sprinkles is a boolean that specifies whether or not that IceCream object has sprinkles - scoops is an integer that specifies the number of scoops that IceCreamobject has - The constructor should default to no sprinkles and a single scoop when an IceCreamobject is initialized! Don't worry about returning or printing anything outside of your setters/getters -- this will happen behind the scenes and check whether your code is correct! Some tests will give feedback if your code is incorrect.
Ice Cream Constructor & Getters/Setters Complete the code for the class IceCream. You have to implement all the accessor and mutator (getter/setter) methods for each of these 2 attributes, as well as its constructor - sprinkles is a boolean that specifies whether or not that IceCream object has sprinkles - scoops is an integer that specifies the number of scoops that IceCreamobject has - The constructor should default to no sprinkles and a single scoop when an IceCreamobject is initialized! Don't worry about returning or printing anything outside of your setters/getters -- this will happen behind the scenes and check whether your code is correct! Some tests will give feedback if your code is incorrect. 2 1 public class IceCream{ //class attributes 3 private boolean sprinkles; 4 private int scoops: 5 // TODO: add a constructor for the IceCream class 7 // When an IceCream object is created, it should default to no sprinkles and a single scoop. 6 8 9 10 11 // TODO: add getter/setter methods for all the properties of the class // There has to be 4 methods in total here (setSprinkles, getSprinkles, setScoops, getScoops). 12 13 14 15 16 }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started