Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Make sure to show your mycandy file, your source code, and your program output. You can make all three parts here be part of one
Make sure to show your mycandy file, your source code, and your program output. You can make all three parts here be part of one program just make sure to show your source code and output and comment where part part and part is in your code.Part make a comma separated fileCreate a simple text file called mycandyThe first line of the file will beCandy Name, Candy Calories, Total Fat GramsAlmond Joy, Snickers, Next, add five lines to the file by hand using your favorite five candy bars information. Each line's data will be separated by commas.Part read in the file and make a list of candy objectsCreate a class called Candy which keeps track of the three pieces of informationRead in the file line by line and create a Candy class instance for each candy bar you have, and add that new instance to a list.Once you have the list created its easiest to use a LinkedList loop through the list and print the candy bar info out to the consolePart append a line to the fileWhen you want to append to a file your second argument to the file writer is usually true which is to say, if the file exists, you want to append to it Add a line of code to append one more candy bars information to your mycandy file. Show what your new text file looks like after the append
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