Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class MainClass {
- public static void Main (string[] args) {
- Queue<Reservation> reserve = new Queue<Reservation>();
- string name,sex; int age;
- int inp = 0, ticket =0;
- int count =0;
- int i =0;
- while(inp != 3)
- {
- Console.WriteLine("");
- Console.WriteLine(" ----- Cenima Ticketing System -----");
- Console.WriteLine("| 1. Reserve Ticket |");
- Console.WriteLine("| 2. View Tickets |");
- Console.WriteLine(" -----------------------------------");
- Console.WriteLine("");
- Console.Write("Enter Number: ");
- inp = int.Parse(Console.ReadLine());
- if(inp == 1)
- {
- Console.Write("Enter Number of Ticket: ");
- ticket = int.Parse(Console.ReadLine());
- Console.WriteLine("");
- for(i = 0; i < ticket; i++){
- count = i+1;
- Console.WriteLine("");
- Console.WriteLine("Ticket {0}",count);
- Console.Write("Enter Full Name: ");
- name = Console.ReadLine();
- Console.Write("Enter Age: ");
- age = int.Parse(Console.ReadLine());
- Console.Write("Enter Sex: M/F ");
- sex = Console.ReadLine();
- Reservation res = new Reservation(count,name,age,sex);
- reserve.Enqueue(res);
- }
- }
- else if(inp == 2)
- {
- Console.WriteLine("");
- Console.WriteLine("Total Ticket: {0}",ticket);
- foreach(Reservation r in reserve)
- {
- Console.WriteLine("Ticket: {0}",r.Ticket);
- Console.WriteLine("Name : {0}",r.Name);
- Console.WriteLine("Age : {0}",r.Age);
- Console.WriteLine("Sex : {0}",r.Sex);
- Console.WriteLine("");
- }
- }
- }
- }
- }
- class Reservation
- {
- private string name;
- private int age;
- private string sex;
- private int ticket;
- public Reservation(int aTicket, string aName, int aAge , string aSex)
- {
- name = aName;
- age = aAge;
- sex = aSex;
- ticket = aTicket;
- }
- public int Ticket
- {
- get
- {
- return ticket;
- }
- set
- {
- ticket = value;
- }
- }
- public string Name{
- get
- {
- return name;
- }
- set
- {
- name = value;
- }
- }
- public int Age{
- get
- {
- return age;
- }
- set
- {
- age = value;
- }
- }
- public string Sex
- {
- get
- {
- return sex;
- }
- set
- {
- sex = value;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement