Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication7
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int ticketA=0, ticketB=0, ticketC=0; // A הגרלה B כניסה להופעה C כניסה למזנון
  14. int currentAmount=0, freeTickets=0, totalAttendees=0, ticketType=0;
  15. while (1 > 0)
  16. {
  17. Console.WriteLine("Which ticket would you like to buy? (1-3)");
  18. ticketType = int.Parse(Console.ReadLine());
  19. if (ticketType == 1)
  20. {
  21. Console.WriteLine("Please enter the amount of tickets.");
  22. currentAmount = int.Parse(Console.ReadLine());
  23. if (currentAmount > 10)
  24. {
  25. freeTickets++;
  26. currentAmount++;
  27. Console.WriteLine("You qualify for a free ticket!");
  28. }
  29. Console.WriteLine("Your total is {0} tickets.", currentAmount);
  30. ticketA = ticketA + currentAmount;
  31. totalAttendees++;
  32. }
  33. else
  34. if (ticketType == 2)
  35. {
  36. Console.WriteLine("Please enter the amount of tickets.");
  37. currentAmount = int.Parse(Console.ReadLine());
  38. Console.WriteLine("Your total is {0} tickets.", currentAmount);
  39. ticketB = ticketB + currentAmount;
  40. totalAttendees++;
  41. }
  42. else
  43. if (ticketType == 3)
  44. {
  45. Console.WriteLine("Please enter the amount of tickets.");
  46. currentAmount = int.Parse(Console.ReadLine());
  47. Console.WriteLine("Your total is {0} tickets.", currentAmount);
  48. ticketC = ticketC + currentAmount;
  49. totalAttendees++;
  50. }
  51. else
  52. if(ticketType == -1)
  53. {
  54. Console.WriteLine("Ending sequence initiated. A total of {0} people have attended the event, {1} A type tickets were sold. {2} B type tickets were sold. {3} C type tickets were sold and {4} free tickets were given out.", totalAttendees, ticketA, ticketB, ticketC, freeTickets);
  55. break;
  56. }
  57. }
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement