Presentation is loading. Please wait.

Presentation is loading. Please wait.

UOP ECET 370 W EEK 3 L AB 3 L INKED L ISTS

Similar presentations


Presentation on theme: "UOP ECET 370 W EEK 3 L AB 3 L INKED L ISTS "— Presentation transcript:

1 UOP ECET 370 W EEK 3 L AB 3 L INKED L ISTS C HECK THIS A+ TUTORIAL GUIDELINE AT HTTP :// WWW. ASSIGNMENTCLOUD. COM / ECET -370/ ECET -370- WEEK -3- LAB -3- LINKED - LISTS F OR MORE CLASSES VISIT HTTP :// WWW. ASSIGNMENTCLOUD. COM G ENERAL I NSTRUCTIONS E XERCISES 1, 2, AND 3 USE THE PROGRAMS IN D OC S HARINGLABELED “U SER - DEFINED LINKED LIST." E XERCISE 4 USES THE PROGRAMS IN D OC S HARINGLABELED “U SING JAVA. UTIL.L INKED L IST." E XERCISE 1: R EVIEW OF L INKED L ISTS C REATE A PROJECT USING THE CLASSES IN THE D OC S HARING AREA LABELED “U SER - DEFINED LINKED LIST." C OMPILE IT, RUN IT, AND REVIEW THE CODE THAT IS GIVEN CAREFULLY. T HIS CODE TESTS THE L INKED L IST CLASS PROVIDED IN THE LECTURE. E XTEND THE CLASS M AIN TO TEST THE FUNCTIONS IS E MPTY, SEARCH AND REMOVE OF THE CLASS L INKED L IST. E XERCISE 2: A U SER -D EFINED L INKED L IST M ODIFY THE CLASS L INKED L IST GIVEN IN THE LECTURE BY ADDING TO IT THE FUNCTIONS LISTED BELOW FOR E XERCISE 2. I N EACH CASE, THE APPROPRIATE ERROR MESSAGE SHOULD BE GENERATED IF AN INVALID CONDITION OCCURS. A. TO S TRING (): MODIFY THE DISPLAY FUNCTION TO OVERLOAD THE TO S TRING FUNCTION OF THE O BJECT CLASS. B. INT LENGTH (): CREATE THIS FUNCTION TO DETERMINE THE NUMBER OF ITEMS IN THE LIST ( ACCESSOR FUNCTION ). C. VOID CLEAR (): CREATE THIS FUNCTION TO REMOVE ALL OF THE ITEMS FROM THE LIST. A FTER THIS OPERATION IS COMPLETED, THE LENGTH OF THE LIST IS ZERO. D. VOID INSERT E ND ( INT ITEM ): CREATE THIS FUNCTION TO INSERT ITEM AT THE END OF THE LIST. E. VOID HTTP :// WWW. ASSIGNMENTCLOUD. COM / ECET -370/ ECET -370- WEEK -3- LAB -3- LINKED - LISTS HTTP :// WWW. ASSIGNMENTCLOUD. COM

2 REPLACE ( INT LOCATION, INT ITEM ): CREATE THIS FUNCTION TO REPLACE THE ITEM IN THE LIST AT THE POSITION SPECIFIED BY LOCATION. T HE ITEM SHOULD BE REPLACED WITH ITEM. F. INT GET ( INT LOCATION ): CREATE A FUNCTION THAT RETURNS THE ELEMENT AT THE POSITION LOCATION. E XERCISE 3: U SING A L INKED L IST T HIS EXERCISE IS SIMILAR TO E XERCISE 3 IN L AB 2, BUT USES THE L INKED L IST CLASS IMPLEMENTED IN E XERCISE 2 ABOVE. T HAT IS, USING THE CLASS L INKED L IST, WRITE A PROGRAM THAT USES IT TO STORE 100 RANDOM NUMBERS. A GAIN, CONSIDER THAT EACH OF THESE RANDOM NUMBERS IS AN INTEGER IN THE INTERVAL [0, 200]. W RITE THE PROGRAM IN SUCH A WAY THAT THERE ARE NO NUMBER DUPLICATES. E XERCISE 4: R EVIEW OF THE L IBRARY C LASS JAVA. UTIL.L INKED L IST C REATE A PROJECT USING THE CLASS IN THE D OC S HARING AREA LABELED “U SING JAVA. UTIL.L INKED L IST." C OMPILE IT, RUN IT, AND REVIEW THE CODE THAT IS GIVEN CAREFULLY. T HIS CODE IS THE COMPLETE PROGRAM GIVEN IN OUR LECTURE THAT TESTS THE LIBRARY CLASS JAVA. UTIL.L INKED L IST. E XERCISE 5: U SING THE L IBRARY C LASS JAVA. UTIL.L INKED L IST R EWRITE E XERCISE 3 ( ABOVE ) USING THE CLASS JAVA. UTIL.L INKED L IST TO STORE THE 100 RANDOM NUMBERS.


Download ppt "UOP ECET 370 W EEK 3 L AB 3 L INKED L ISTS "

Similar presentations


Ads by Google