CIS 2279 Homework Assignment #02

Due Mon, Sep 5, 2016

  1. Create a perl script named username-lab02.pl. The script must perform the following:
    1. Create a single array containing the names of four of your favorite foods and a second array with four of your least liked foods.
    2. Add another element to the end of each array by asking the user for another food the like/hate.
    3. Print out the last two items in the least liked foods array. Include some descriptive text to clarify your output.
    4. For the "favorite foods" array, move the value of the first element of the array to become the last element of the same array.
    5. Print out the first and last elements of both arrays to show the changes from the previous step along with some descriptive text.
    6. Remove the last element of the favorite foods array and add it to the beginning of the disliked foods array
    7. Print out the first and last elements of both arrays to show the changes from the previous step along with some descriptive text.
    8. Remove the last element of the disliked foods array and display it to the terminal with some descriptive text.
    9. Print to the terminal the number of elements in each array with some text.
    10. Delete both arrays before exiting the program.

Solution

last updated: 01 Sep 2016 16:06