[Solved] ArrayBasedGroceryList4

30 $

SKU: [Solved] ArrayBasedGroceryList4 Category: Tag:
  • The goal of this code is to understand how the programArrayBasedGroceryList4.java is organized into methods and how it uses parallel arrays to store the data of the grocery list by adding one more array that stores the name of the store where each item will be bought.
    1. Download the program and change the program name and class name to your last and first name. You will have to change the program name in 7 places. In other words, change ArrayBasedGroceryList4 to LastnameFirstname4.
    2. Here is the input file for your program: csv, which has a third column for the store for each item. Please download it. It will be the 1st commandline argument in your program. The 2nd commandline arguments will be your output file name, which you can name as you wish. Maybe call it: output4.csv
    3. The 1st step is to make sure your program compiles and runs with correct input and output for the input file: csv. Test the add, delete, and display for the items’ names and numbers. And make sure your output file output4.csv has the items’ names and numbers. You will not see the store names when you run the program or when you open the output file. That is fine. This will be your next step!
    4. Add another array to store the names of the stores. It should be an array of strings. Add the stores[] array to the parameters of each method. Don’t forget to add the stores[] array to the Java Documentation above each method as well!
    5. See the example input and output below to see what your program should be doing.
    6. ** Do NOT re-write the javaprogram from scratch. It has already been written for you as an example of implementing a grocery list. The goal of this assignment is to understand the existing code and to improve the existing code by adding another array. This is an example of “bento code” from the lecture slides. Programs should be written using methods, so it is easy to modify, maintain, and improve the code. **
    7. Write your original commentsevery 3-5 lines of code.
    8. Make sure your code follows the ICS 211 Java Coding Standard, in particular the Java documentation (Javadoc) comments that go above each method.

sample outpout

Read from file: input4.csv

GROCERY LIST MENU

Enter 1 to Add

Enter 2 to Delete

Enter 3 to Display

Enter 4 to Quit

Enter your choice: 3

Row Name Number Store

1 natto 3 Don Quijote

2 eggs 12 Whole Foods

3 shiitake 1 farmer’s market

4 negi 1 farmer’s market

5 garlic 5 Costco

6 umeboshi 1 Don Quijote

GROCERY LIST MENU

Enter 1 to Add

Enter 2 to Delete

Enter 3 to Display

Enter 4 to Quit

Enter your choice: 1

Enter name of item: BANANAS

Enter number of items: 100

Enter store of item: COSTCO

Added row #7: BANANAS 100 COSTCO

GROCERY LIST MENU

Enter 1 to Add

Enter 2 to Delete

Enter 3 to Display

Enter 4 to Quit

Enter your choice: 3

Row Name Number Store

1 natto 3 Don Quijote

2 eggs 12 Whole Foods

3 shiitake 1 farmer’s market

4 negi 1 farmer’s market

5 garlic 5 Costco

6 umeboshi 1 Don Quijote

7 BANANAS 100 COSTCO

GROCERY LIST MENU

Enter 1 to Add

Enter 2 to Delete

Enter 3 to Display

Enter 4 to Quit

Enter your choice: 2

Enter the row number of the item you wish to delete: 3

Deleting row #3: shiitake 1 farmer’s market

GROCERY LIST MENU

Enter 1 to Add

Enter 2 to Delete

Enter 3 to Display

Enter 4 to Quit

Enter your choice: 3

Row Name Number Store

1 natto 3 Don Quijote

2 eggs 12 Whole Foods

3 negi 1 farmer’s market

4 garlic 5 Costco

5 umeboshi 1 Don Quijote

6 BANANAS 100 COSTCO

GROCERY LIST MENU

Enter 1 to Add

Enter 2 to Delete

Enter 3 to Display

Enter 4 to Quit

Enter your choice: 4

Wrote to file: output4.csv

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] ArrayBasedGroceryList4
30 $