We have simply called the method to remove which we have coded in Stock class. If stock is available in record then it will be removed on the given quantity provided by user. Removal of stock is taken place by its name. ‘Add’ function of ArrayList has been used to add stocks in record. For adding stock user need to give stock name, quantity, and price. There are four options will appear as – Add stock, Remove stock, View stock and Exit. Stock management system class has main method. It also has method for removing stock with condition of quantity to remove is less than available quantity. Stock class has all the getters and setters for stock name, quantity, and price. Our program consists of two classes named as StockManagementSystem and Stock. ArrayList is for storing the stocks while Scanner class is for taking the output from user through keyboard. We have used inbuilt classes ArrayList and Scanner. The Stock Management System we will build will be a simple console-based application that allows users to add, remove and view all the available stocks and their amount.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |