Instructions:Write a Java program called to create an Excel spreadsheet Create a

Sep 1, 2021 | Uncategorized

Instructions:Write a Java program called to create an Excel spreadsheet
Create a class called Food to represent a Thanksgiving food item. Fields include name, calories, carbs (1 point)

In a main method (of a different class), ask the user 201C;How many foods are you going to eat for Thanksgiving?201D;.
Loop through each food item and prompt the user to enter the name, calories, and grams of carbs for that food item. Create a Food object with this data, and store each Food object in an ArrayList (2 points)

Don't use plagiarized sources. Get Your Custom Essay on
Instructions:Write a Java program called to create an Excel spreadsheet Create a
Just from $12/Page
Order Essay

Create a method called printThanksgivingDinner(), that will take an ArrayList of Food objects as an argument and create an Excel spreadsheet. This method should loop through the ArrayList and write the data to a file called thanksgiving.csv (CSV stands for Coma Separated Values) (1 point)

The data should be printed in this format below. Be sure to include a header as the first line of code written the the file, and a total row at the end. You will see that every row will be a new row in the Excel spreadsheet, and every coma will create a new column. (1 point)

After collecting all the food data in your main method, pass the ArrayList to the printThanksgivingDinner () method. (1 point)

Hint: To append to a file, check out Example thanksgiving.csv file (You should be able to open this file in Excel)Name, Calories, CarbsTurkey, 200, 18.3Mashed Potatoes, 300, 12.4Corn, 100, 9.5Total, 400, 30.2

  

Why dont you let a reliable essay writing service handle your assignments ?