sample
Haven't found the Essay You Want?
For Only $12.90/page

Search and sort Essay

Direction: Provide the appropriate output for the following 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 program 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 descending order and they need to be put in ascending order. Write a Java method that takes as input an array of items in descending 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 array. 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 store’s inventory. The store sells various items. For each item in the store, the following information is kept: item ID, item name, number of pieces ordered, number of pieces currently in the store, number of pieces sold, manufacturer’s price of the item, and the store’s selling price. At the end of each week, the store
manager would like to see a report in the following form:

Friendly Hardware Store
itemID itemName pOrdered pInStore pSold manufPrice sellingPrice 4444 Circular Saw 150 150 40 45.00 125.00
3333 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, such 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: itemID

itemName
pOrdered manufPrice sellingPrice
Use seven parallel vectors to store the information. The program must contain at least the following methods—a 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.


Essay Topics:


Sorry, but copying text is forbidden on this website. If you need this or any other sample, we can send it to you via email. Please, specify your valid email address

We can't stand spam as much as you do No, thanks. I prefer suffering on my own

Courtney from Study Moose

Hi there, would you like to get such a paper? How about receiving a customized one? Check it out https://goo.gl/3TYhaX