Question
Code the SinglyLinkedList class from our class notes (L03_). Override the toString method by using StringBuilder to list every element, in order from head to
Code the SinglyLinkedList class from our class notes (L03_). Override the toString method by using StringBuilder to list every element, in order from head to tail. In the same Lab3_Driver file, create a SinglyLinkedList instance called productList that holds a list of DairyProduct. Add elements into the SinglyLinkedList instance so that the following statement(in your driver file): System.out.println(productList); would display the following output: [Milk(4L) : 5.05, Cheese Sticks : 3.99, Yoghurt : 4.99, Ice cream(1L) : 2.99, Butter : 5.65, Drinkable yoghurt : 4.99] Note that your list must be built to contain and display these products in this order.
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