Question: Write a jave program for the following. Create a simple text file called mycandy The first line of the file will be Candy Name, Candy

Write a jave program for the following. Create a simple text file called mycandy
The first line of the file will be
Candy Name, Candy Calories, Total Fat Grams
Almond Joy, 250,9
Snickers, 240,4
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. Then 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!