Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need this in java not c++ or python please if you can include steps and explanation im confused File IIO Make sure to show

I need this in java not c++ or python please if you can include steps and explanation im confused

image text in transcribedimage text in transcribed
File IIO Make sure to show your mycandy file, your source code: and your program output (10 pts) Part 1 make a comma separated file Create a simple text file called mycandy The first line ofthe file will be Candy Name, lCandy Calories, Total Fat Grams Almond Joy, 259: 9 Snickers: 240: 4 Next, add the lines to the file by hand using your favorite five candy bars information. Each line's data will be separated by commas. (70 pts) Part 2 read in the file and make a list of candy objects Create a class called Candy which keeps track of the three pieces of information Read 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 an ArrayList) _. loop through the list and print the candy bar info out to the console Hints: look at my ListofObjects google doc Hints: look at Strithplit google doc Hints: look at my FilelO google docts) and watch the File IO lecture{s} as needed Hints: I HAVE AN ALREADY CODED EXAMPLE WHICH IS NEAR EXACT/VERY CLOSE TO THE SOLUTION, Hints: I HAVE AN ALREADY CODED EXAMPLE WHICH IS NEAR EXACT/VERY CLOSE TO THE SOLUTION, YOU NEED TO LOOK IN Filelocsv in the class notes for this, it will make the assignment much easier! (20 pts) Part 3 append a line to the file When 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 bar's information to your mycandy file. Show what your new text file looks like after the append Hints: look at my FileIO google docs and find the file append example, and watch the File IO lecture Hints" don't forget to open the file for append, add a new Candy bars info, then close the file. Don't forget to indicate in your source code where you do this. References Refer to my class notes on File IO https://zetcode.com/java/appendfile/ https://www.programiz.com/java-programming/examples/append-text-existing-file

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

What is the value of the golden ratio to the nearest thousandth?

Answered: 1 week ago