Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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,
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. 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
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