Answered step by step
Verified Expert Solution
Link Copied!

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, 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

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

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions