Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. //Variable for user input
  2. string albumInput
  3.  
  4. //Ask for the user for details
  5. Console.WriteLine("Enter the Title of the album you would like to store");
  6. albumInput = Console.ReadLine();
  7.  
  8. //Process the input of the user to make it easier to search later on
  9. albumInput = albumInput.ToUpper();
  10. albumInput = albumInput.Trim();
  11.  
  12. //Find an empty spot within list
  13. int nextAvailableSpace = FindSlot("");
  14. if (nextAvailableSpace != -1)
  15. {
  16. //Put customer information within an empty slot into the car park
  17. albumNames[nextAvailableSpace] = albumInput;
  18. }
  19. else
  20. {
  21. //Inform that the usercannot park as the parking space is full
  22. Console.WriteLine("Sorry, but there are no available spaces left to store your album.");
  23. Console.ReadLine();
  24. }
  25. }
  26.  
  27. //Finding an empty slot for the user to put their car in
  28. {
  29. int result = - 1;
  30. for (int index = 0; index < albumNames.Length; index++)
  31. {
  32. if (albumNames[index] == albumNames)
  33. {
  34. result = index;
  35. break;
  36. }
  37.  
  38. else if (albumName == "" && albumNames[index] == null)
  39. {
  40. result = index;
  41. break;
  42.  
  43. }
  44. }
  45.  
  46. return result;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement