87.7k views
4 votes
In this assignment, you should show your understanding of arrays by doing the following: - declaring arrays and assigning values to array elements - access array elements - loop through arrays - use Array class methods Movie Titles Application Create a program that can be used to temporarily store and display to the user different movie titles arranged in ascending order. The program should work as follows: - Prompts a user for a value greater than zero (0). Note: The program should continue asking for a valid value if the input is incorrect (i.e. not greater than 0 - Use this value to create an array of size equal to the number input by the user - Use loops to prompt the user to input movie titles until the array is full - Display to the user the movie titles input - each title on a separate line - Rearrange the items in the array in ascending order - Display the movie titles back to the user in the new order

1 Answer

7 votes

Final answer:

The student must create a program to store, display, and sort movie titles using arrays, demonstrating skills such as declaring arrays, accessing elements, looping, and using Array class methods.

Step-by-step explanation:

The assignment is focused on demonstrating one's understanding of arrays in programming. The task at hand is to create a program that performs a series of actions with an array which involves storing and sorting movie titles.

  • Declare an array and assign values to its elements.
  • Access and loop through array elements using a loop structure.
  • Utilize Array class methods to rearrange the movie titles in ascending order.
  • Prompt the user to enter the number of movie titles they would like to input, ensuring the value is greater than zero.
  • Store user-provided movie titles in the array.
  • Display the unsorted list of movie titles, each on a separate line.
  • Sort the array and then display the sorted list of movie titles back to the user.

The successful program will showcase competency in using arrays to manage a collection of strings and output them before and after applying sorting mechanisms.

User Keerthee
by
7.2k points