Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Variable for user input
- string albumInput
- //Ask for the user for details
- Console.WriteLine("Enter the Title of the album you would like to store");
- albumInput = Console.ReadLine();
- //Process the input of the user to make it easier to search later on
- albumInput = albumInput.ToUpper();
- albumInput = albumInput.Trim();
- //Find an empty spot within list
- int nextAvailableSpace = FindSlot("");
- if (nextAvailableSpace != -1)
- {
- //Put customer information within an empty slot into the car park
- albumNames[nextAvailableSpace] = albumInput;
- }
- else
- {
- //Inform that the usercannot park as the parking space is full
- Console.WriteLine("Sorry, but there are no available spaces left to store your album.");
- Console.ReadLine();
- }
- }
- //Finding an empty slot for the user to put their car in
- {
- int result = - 1;
- for (int index = 0; index < albumNames.Length; index++)
- {
- if (albumNames[index] == albumNames)
- {
- result = index;
- break;
- }
- else if (albumName == "" && albumNames[index] == null)
- {
- result = index;
- break;
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement