Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bell-kevin/improvedinventoryprogram
You created an inventory program in Ch 9 using an array with size of 2. As you’ve learned, when you don’t know how big an array needs to be, it’s better to use an array list. Make a COPY of the Ch 9 inventory project and change it to use an array list. Does anything need to change in the inventory class? Nothing – all the same variables and methods are needed. Does anything need to change in the driver class? No, because we are still working with a store that has inventory. The class for the store needs to change, from using an array of size 2 for the inventory items for the store, to an ArrayList of unknown size for the inventory items. Because the array had a known size, you probably used a For loop to go through the array to add inventory items. In this version, you need to ask the user if they want to continue adding more inventory items, and repeat that work if the answer is “yes”. In the Ch 9 version, you created a method to find an item in inventory, which returned the index number for that object in the inventory array. If the name of the array was “items”, you referenced an inventory item like this: items[k]. Since this version uses an array list, you can’t use the name with an index like that – you have to use the “get” method, items.get(k). You can chain other methods to it, like the sell method. You will probably need to make changes in the find and sell methods you created to access the elements in the array list instead of in the array. When the program runs, it should ask the user for inventory information, and ask if they want to continue to add more inventory, instead of asking for 2 items and no more. Thus the user can enter any number of items. Otherwise, the program should appear to behave exactly the same as it did in Ch 9. There could be more items added as appropriate – array lists make it very easy to increase the size of the array with no extra coding. Second part, purchasing items from inventory. This should behave exactly as seen previously, the only difference being the number of items to display in the inventory listing. Take a screenshot of your version of the sample session. Submission: the specified screenshots, and the root folder for the project Pay careful attention to the rubric for this assignment. Remember the standards that apply to every project. Note that you must use correct formatting in the code -- appropriate indentation is most important. You can use Shift-Alt-F to have NetBeans automatically format the code correctly. If the formatting is incorrect, it will be returned to you for changes with a grade of zero. Note: You need to submit the whole project for these assignments. In File Explorer, go to the location where you created the project. There will be a folder with the name of your project -- that is the root folder of the project. If you submit the root folder of the project, the instructor can run it on a different machine to grade it. If you don't submit the proper folder, it won't run on another machine, and the assignment will be marked with a zero.
https://github.com/bell-kevin/improvedinventoryprogram
datc davis-tech davis-technical-college object-oriented-programming
Last synced: about 2 months ago
JSON representation
You created an inventory program in Ch 9 using an array with size of 2. As you’ve learned, when you don’t know how big an array needs to be, it’s better to use an array list. Make a COPY of the Ch 9 inventory project and change it to use an array list. Does anything need to change in the inventory class? Nothing – all the same variables and methods are needed. Does anything need to change in the driver class? No, because we are still working with a store that has inventory. The class for the store needs to change, from using an array of size 2 for the inventory items for the store, to an ArrayList of unknown size for the inventory items. Because the array had a known size, you probably used a For loop to go through the array to add inventory items. In this version, you need to ask the user if they want to continue adding more inventory items, and repeat that work if the answer is “yes”. In the Ch 9 version, you created a method to find an item in inventory, which returned the index number for that object in the inventory array. If the name of the array was “items”, you referenced an inventory item like this: items[k]. Since this version uses an array list, you can’t use the name with an index like that – you have to use the “get” method, items.get(k). You can chain other methods to it, like the sell method. You will probably need to make changes in the find and sell methods you created to access the elements in the array list instead of in the array. When the program runs, it should ask the user for inventory information, and ask if they want to continue to add more inventory, instead of asking for 2 items and no more. Thus the user can enter any number of items. Otherwise, the program should appear to behave exactly the same as it did in Ch 9. There could be more items added as appropriate – array lists make it very easy to increase the size of the array with no extra coding. Second part, purchasing items from inventory. This should behave exactly as seen previously, the only difference being the number of items to display in the inventory listing. Take a screenshot of your version of the sample session. Submission: the specified screenshots, and the root folder for the project Pay careful attention to the rubric for this assignment. Remember the standards that apply to every project. Note that you must use correct formatting in the code -- appropriate indentation is most important. You can use Shift-Alt-F to have NetBeans automatically format the code correctly. If the formatting is incorrect, it will be returned to you for changes with a grade of zero. Note: You need to submit the whole project for these assignments. In File Explorer, go to the location where you created the project. There will be a folder with the name of your project -- that is the root folder of the project. If you submit the root folder of the project, the instructor can run it on a different machine to grade it. If you don't submit the proper folder, it won't run on another machine, and the assignment will be marked with a zero.
- Host: GitHub
- URL: https://github.com/bell-kevin/improvedinventoryprogram
- Owner: bell-kevin
- License: gpl-3.0
- Created: 2022-06-28T00:42:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-06T22:43:39.000Z (over 2 years ago)
- Last Synced: 2024-05-02T04:16:01.312Z (9 months ago)
- Topics: datc, davis-tech, davis-technical-college, object-oriented-programming
- Language: Java
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0