Question: Create a class called Dessert ( you ll need to create a new file and add it to Git ) inside of the src /
Create a class called Dessert youll need to create a new file and add it to Git inside of the src folder. This class should have the following characteristics:
Two instance variables: int flavor and int price.
A constructor that takes two parameters int flavor and int price and sets the instance variables accordingly.
One static variable int numDesserts that keeps track of the number of desserts created so far.
A method public void printDessert that prints the flavor and price of the dessert, along with the total number of desserts created so far, separated by a space.
For example, if we create a dessert with flavor and price and then call its printDessert method, it should print
If we then create a dessert with flavor and price and then call its printDessert method, it should print
Lastly, a method public static void mainString args that only prints the line I love dessert! when executed.
Be sure to implement the above behavior exactly, otherwise you may not pass the tests!
When you have completed Dessert.java, uncomment the appropriate lines in testsDessertTest and run the test.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
