Answered step by step
Verified Expert Solution
Link Copied!

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 1, part 2, and part 3 is in your code.Part 1 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, 250,9Snickers, 240,4Next, 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 2 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 3 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

24. Solve. x-2x-8-0

Answered: 1 week ago