Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication7
- {
- class Program
- {
- static void Main(string[] args)
- {
- int ticketA=0, ticketB=0, ticketC=0; // A הגרלה B כניסה להופעה C כניסה למזנון
- int currentAmount=0, freeTickets=0, totalAttendees=0, ticketType=0;
- while (1 > 0)
- {
- Console.WriteLine("Which ticket would you like to buy? (1-3)");
- ticketType = int.Parse(Console.ReadLine());
- if (ticketType == 1)
- {
- Console.WriteLine("Please enter the amount of tickets.");
- currentAmount = int.Parse(Console.ReadLine());
- if (currentAmount > 10)
- {
- freeTickets++;
- currentAmount++;
- Console.WriteLine("You qualify for a free ticket!");
- }
- Console.WriteLine("Your total is {0} tickets.", currentAmount);
- ticketA = ticketA + currentAmount;
- totalAttendees++;
- }
- else
- if (ticketType == 2)
- {
- Console.WriteLine("Please enter the amount of tickets.");
- currentAmount = int.Parse(Console.ReadLine());
- Console.WriteLine("Your total is {0} tickets.", currentAmount);
- ticketB = ticketB + currentAmount;
- totalAttendees++;
- }
- else
- if (ticketType == 3)
- {
- Console.WriteLine("Please enter the amount of tickets.");
- currentAmount = int.Parse(Console.ReadLine());
- Console.WriteLine("Your total is {0} tickets.", currentAmount);
- ticketC = ticketC + currentAmount;
- totalAttendees++;
- }
- else
- if(ticketType == -1)
- {
- 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);
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement