Thursday, June 6, 2019

Search and sort Essay Example for Free

Search and sort EssayDirection Provide the appropriate output for the pastime machine problems. Note To authenticate the output, please insert the printscreen and the source code in a zip file. Deadline of submission September 18, 2013 (no extension).1. Write a class to test the method binarySearch. Use either the method insertionSort or selectionSort to sort the list before the search.2. Suppose that the elements of a list are in go down order and they need to be put in ascending order. Write a Java method that takes as input an array of items in come down order and the number of elements in the array. The method rearranges the element of the array in ascending order. Your method must not incorporate any sorting algorithms, that is, no item comparisons should occur.3. Write a method, remove that takes three parameters an array of integers, the length of the array, and an integer, say, removeItem. The method should find and delete the first occurrence of removeItem in the ar ray. If the value does not exist or the array is empty, output an appropriate message. (Note that after deleting the element, the array size is reduced by 1.) You may assume that the array is unsorted.4. Write a method, removeAt, that takes three parameters an array of integers, the length of the array, and an integer, say, index. The method deletes the array element indicated by index. If index is out of range or the array is empty, output an appropriate message. (Note that after deleting the element, the array size is reduced by 1.) You may assume that the array is unsorted.5. Write a program to keep track of a hardware computer storages inventory. The store sells various items. For each item in the store, the following in mildewation is kept item ID, item name, number of pieces ordered, number of pieces presently in the store, number of pieces sold, manufacturers price of the item, and the stores selling price. At the end of each week, the storemanager would like to see a repor t in the following formFriendly Hardware StoreitemID itemName pOrdered pInStore pSold manufPrice sellingPrice 4444 Circular Saw 150 150 40 45.00 125.003333 Cooking Range 50 50 20 450.00 850.00...Total Inventory PHP .Total number of items in the store _______The total inventory is the total selling value of all the items currently in the store. The total number of items is the sum of the number of pieces of all the items in the store. Your program must be menu driven, giving the user various choices, much(prenominal) as check whether an item is in the store, sell an item, and print the report. After inputting the data, sort it according to the items names. Also, after an item is sold, update the appropriate counts. Initially, the number of pieces (of an item) in the store is the same as the number of pieces ordered, and the number of pieces of an item sold is zero. Input to the program is a file consisting of data in the following form itemIDitemNamepOrdered manufPrice sellingPriceU se seven parallel vectors to store the information. The program must contain at least the following methodsa method to input the data into the vectors, a method to display the menu, a method to sell an item, and a method to print the report for the manager. After inputting the data, sort it according to the items names.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.