Advertisement
SarahJoseph

C# Key Problem

Nov 10th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace GameEdition3
  7. {
  8. class Data
  9. {
  10. private string strInstructions;
  11. private string strTitleMenu;
  12. public string result = String.Empty;
  13.  
  14. public string Information()
  15. {
  16. strInstructions = "Instructions: \n \n" +
  17. "Press 1 on your keyboard to add an item to your inventory \nPress 2 on your keyboard to Display All Items. \nPress 3 on your keyboard to choose a random Item \nPress 4 to exit the program"
  18. + " \n \nPress Backspace to go back to the menu";
  19. return strInstructions;
  20. }
  21.  
  22. public string TitleMenu()
  23. {
  24. strTitleMenu = "1. Add New Item\n2. Display All Items \n3. Random Item \n4. Quit " +
  25. "\nPress I for instructions";
  26. return strTitleMenu;
  27. }
  28.  
  29. public string myFunction()
  30. {
  31.  
  32. string input = Console.ReadLine();
  33. switch (input)
  34. {
  35.  
  36. case "Warhammer":
  37. result = "Warhammer";
  38. return "Warhammer is selected";
  39.  
  40. case "Heavy Armor":
  41. result = "Heavy Armor";
  42. return "Heavy Armor is selected";
  43.  
  44. case "Boots":
  45. result = "Boots";
  46. return "Boots is selected";
  47.  
  48. case "Sword":
  49. result = "Sword";
  50. return "Sword is selected";
  51.  
  52. default:
  53. return "Input not reconized, please choose another item";
  54. }
  55. }
  56.  
  57. public Data()
  58. { }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement