Presume that the information layer the system file
CONCLUSION 9
Data structures and algorithm for the foundations on which software applications, and information systems (in this case) particularly are built. This report envisions the data structure and algorithm of a proposed information system for a company. It begins with detailing the class housing all variables in the information’s system and then accessor and mutator methods. It then highlights all the possible operations to be done on the system and analysing the respective algorithm for each.
Below is a list of all the proposed variables, their data-type as well as a brief explanation as per the choice of data-type.
Product Type : This variable would hold information about the type of product in terms of which category it belonged to between household or food item. It would be of string data-type as it is expected to hold characters.
Expiry Date : This carries information of the expiry date of a food item and would be null for household items. It would have a date data-type. (Weiss, 2001)
Having highlighted the envisaged variables in the base product class as well as justified the choice of variable, we would now discuss the operations to be supported by the inventory system.
It then searches linearly through the product list to ascertain if the product is not already in the system if not, it saves the new product to the file by writing it. This operation is given below:
Start of Function ------------------------------------------------------------------------------------------------
if(product.getProductType().equalsIgnoreCase(prod.getProductType()) && (Check for equality of other variables)
present = true;
}
End Function ----------------------------------------------------------------------------------------------------
4. Show all Food Items: Here we again use a linear search technique to search through our product list adding all items with product type saved as food item into a new FoodItem list still of type product and then output result to the requesting entity. This operation is given below :
Start Fuction ----------------------------------------------------------------------------------------------------
if(product.getProductType().equalsIgnoreCase(“Food Item”)
foodItems.add(product)
5. Show all Household Items: Here we again use a linear search technique to to search through our product list adding all items with product type saved as household item into a new House hold list still of type product and then output result to the requesting entity. This operation is given below
Start Fuction ----------------------------------------------------------------------------------------------------
if(product.getProductType().equalsIgnoreCase(“Household Item”)
householdItems.add(product)
6. Show all Expired Products: We search through the products list to get all expired products where expiry date is less that today’s date (date of Search). We then output list of expired products to the requesting entities. This operation is given below.
Start function ---------------------------------------------------------------------------------------------------
if(product.getExpiryDate() < Date.today())
expiredItems.add(product)
7. Count all Products : To get a count of all products in the inventory, we just get the size of our products list. This would be the number of inventories on the system.
Start Function ---------------------------------------------------------------------------------------------------
List<Product> foodItems = new ArrayList<>(); // creating list of all food items.
----- a for loop through the ProductList all products ----------------------------------------
}
----------------------- outside loop ----------------------------------------------------------------------------
List<Product> householdItems = new ArrayList<>(); // creating list of all household items.
----- a for loop through the ProductList all products ----------------------------------------
}
----------------------- outside loop ----------------------------------------------------------------------------
loop through product list to find product.
for (Product product : allProducts) {
// after loop the save the allproducts list to file replacing previous entry
End Function ---------------------------------------------------------------------------------------------------------
if (product.getProductID.equalsIgnoreCase( given ID){
//remove product from list
End Function ---------------------------------------------------------------------------------------------------------
12. Find a Product: A product is found using Its ID from the list using a linear search. If found, the full content of the product object is returned to the requesting entity.
if (product.getProductID.equalsIgnoreCase( given ID){
prod = product;
The application would not be modified after the merger mainly due to the fact that the flow of the program doesn’t lend to sorting the data hence constraining us to use linear search methodology in the development of the program. However, we have adopted a strategy ofloading the data once at start of the program to increase the efficiency of the program.
We have designed the program with great emphasis laid on practicability as well as efficiency of the system. While due to structural constraint we have largely used a linear serach approach to search through the data we have however compensated for that in terms of code flow such that the memory intensive reading of the information is done just once and then all operations can access it at runtime to carry out various operations. This then meant that even after the merger and increased data the application needed not be modified.
Sanjay, R., Robert, C., & Hairong Kuang. (2013). The Hadoop Distributed File System.
Weiss, M. A. (2001). Data Structures and Problems Solving in Java. Addison-Wesley Longman Publishing.