week 4 homework

The assignment for the week should be looked at from the perspective of enhancing last week’s assignment using the knowledge acquired this week. This would be achieved by doing the following. 1) Instead of holding the items in Inv as item0, item2, item3 up to item9, you should use array items[MaxItems]. MaxItems should be a static (final) integer initialized to the value of 10, or any value to accommodate the maximum number of items that you want to process. 2) Your program should thus be modified to use array. 3) You should create an instance method for Inv that sorts all the items in order of itemName. The method should be named sortByName(). The instruction for implementing this method is given below. 4) Modify your Invoice class to invoke the sortByName method before invoking the print method. A sort routine is shown in the text in Figure 8-20: The sortStrings() method. This sort routine should be modified as shown below, to accommodate an array of items rather than array of strings. (I threw in some additional curly braces to delineate the blocks. The version of the code in the book might be more difficult to follow.) public static void sortStrings(String[] array, int len) //note that item array is passed { int a,b; String temp; //Your temp would hold item object int highSubscript = len - 1; for(a = 0; a < highSubscript; ++a) { for(b = 0; b < highSubscript; ++b) { if(array[b].compareTo(array[b + 1]) > 0) //You would modify to something like: if(array[b].getItemName().compareTo { temp = array[b]; array[b] = array[b + 1]; array[b + 1] = temp; } } } } The lines that need changes are commented as shown above. Please, do the assignment in steps, so that you can get partial points, in the event that you cannot complete the whole assignment. As usual, ask as much questions as possible, to avoid getting stuck on minor issues

## Deliverables

Working program under Jgrasp ver 1.5.0 in Windows 2000

## Platform

I have attached the zip from last week's assignment. This assignment needs to be changed as decscribed above.

Compétences : Ingénierie, Java, MySQL, PHP, Architecture Logicielle, Tests de Logiciels

en voir plus : ver 5, sort array c, do your homework for you, do homework for you, print hold, len, java invoice, php text array, create java object, object assignment java, code jgrasp, string integer, figure print, jgrasp, invoke process, item assignment java, java object assignment, print routine, event method, zip code class

Concernant l'employeur :
( 118 commentaires ) United States

Nº du projet : #2988265

Décerné à:


See private message.

%selectedBids___i_sum_sub_7% %project_currencyDetails_sign_sub_8% USD en 5 jours
(41 Commentaires)

5 freelance font une offre moyenne de $17 pour ce travail


See private message.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(62 Commentaires)

See private message.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(37 Commentaires)

See private message.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(13 Commentaires)

See private message.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(5 Commentaires)