当前位置: 首页>>代码示例>>C#>>正文


C# Ticket.Pricing方法代码示例

本文整理汇总了C#中Ticket.Pricing方法的典型用法代码示例。如果您正苦于以下问题:C# Ticket.Pricing方法的具体用法?C# Ticket.Pricing怎么用?C# Ticket.Pricing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ticket的用法示例。


在下文中一共展示了Ticket.Pricing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            int NumberOfChildren = 0;
            int NumberOfAdults = 0;
            int NumberOfSeniors = 0;
            int TotalAttendies = 0;

            double TotalTicketPrice = 0;

            int SmallSodaQty;
            int LargeSodaQty;
            int HotDogQty;
            int PopCornQty;
            int CandyQty;

            double TotalFoodPrice = 0;

            const double SmallSoda = 3.50;
            const double LargeSoda = 5.99;
            const double HotDog = 3.99;
            const double Popcorn = 4.50;
            const double Candy = 1.99;

            double GrandTotal = 0;

            int SodaCornDiscountQty = 0;
            int FreePopcornQty = 0;
            int CandyDiscountQty = 0;

            Ticket ChildMatinee = new Ticket("Child Matinee Ticket ", 3.99);
            Ticket AdultMatinee = new Ticket("Adult Matinee Ticket ", 5.99);
            Ticket SeniorMatinee = new Ticket("Senior Matinee Ticket", 4.50);

            Ticket ChildEvening = new Ticket("Child Evening Ticket ", 6.99);
            Ticket AdultEvening = new Ticket("Adult Evening Ticket ", 10.99);
            Ticket SeniorEvening = new Ticket("Senior Evening Ticket", 8.50);

            System.Console.WriteLine("Matinee Ticket Pricing");
            ChildMatinee.Print();
            AdultMatinee.Print();
            SeniorMatinee.Print();

            System.Console.WriteLine("Evening Ticket Pricing");
            ChildEvening.Print();
            AdultEvening.Print();
            SeniorEvening.Print();

            System.Console.WriteLine("Would you like to see a Matinee Showing?");
            if (System.Console.ReadLine().ToLower().StartsWith("y"))
            {
                System.Console.WriteLine("How many children tickets?");
                NumberOfChildren = int.Parse(System.Console.ReadLine());
                ChildMatinee.Pricing(NumberOfChildren);
                TotalTicketPrice += ChildMatinee.TicketTotals();

                System.Console.WriteLine("How many adult tickets?");
                NumberOfAdults = int.Parse(System.Console.ReadLine());
                AdultMatinee.Pricing(NumberOfAdults);
                TotalTicketPrice += AdultMatinee.TicketTotals();

                System.Console.WriteLine("How many senior tickets?");
                NumberOfSeniors = int.Parse(System.Console.ReadLine());
                SeniorMatinee.Pricing(NumberOfSeniors);
                TotalTicketPrice += SeniorMatinee.TicketTotals();
            }
            else
            {
                System.Console.WriteLine("How many children tickets?");
                NumberOfChildren = int.Parse(System.Console.ReadLine());
                ChildEvening.Pricing(NumberOfChildren);
                TotalTicketPrice += ChildEvening.TicketTotals();

                System.Console.WriteLine("How many adult tickets?");
                NumberOfAdults = int.Parse(System.Console.ReadLine());
                AdultEvening.Pricing(NumberOfAdults);
                TotalTicketPrice += AdultEvening.TicketTotals();

                System.Console.WriteLine("How many senior tickets?");
                NumberOfSeniors = int.Parse(System.Console.ReadLine());
                SeniorEvening.Pricing(NumberOfSeniors);
                TotalTicketPrice += SeniorEvening.TicketTotals();
            }

            System.Console.WriteLine("Please indicate how many of each item you would like");

            System.Console.Write("Small Soda $" + SmallSoda + ": ");
            SmallSodaQty = int.Parse(System.Console.ReadLine());
            TotalFoodPrice += (SmallSodaQty * SmallSoda);

            System.Console.Write("Large Soda $" + LargeSoda + ": ");
            LargeSodaQty = int.Parse(System.Console.ReadLine());
            TotalFoodPrice += (LargeSodaQty * LargeSoda);

            System.Console.Write("Hot Dog    $" + HotDog + ": ");
            HotDogQty = int.Parse(System.Console.ReadLine());
            TotalFoodPrice += (HotDogQty * HotDog);

            System.Console.Write("Popcorn    $" + Popcorn + ": ");
            PopCornQty = int.Parse(System.Console.ReadLine());
            TotalFoodPrice += (PopCornQty * Popcorn);
//.........这里部分代码省略.........
开发者ID:kcbwilson,项目名称:IT-1050,代码行数:101,代码来源:Program.cs


注:本文中的Ticket.Pricing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。