コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Product Manager!");

            Product p1 = new Product();

            p1.code        = ".net";
            p1.description = "Murach's C# and .Net";
            p1.price       = 58.99;

            Product p2 = new Product("java", "Murach's Java Programming", 59.50);

            Console.WriteLine("p1 = " + p1);
            Console.WriteLine($"p2 = {p2}");

            String code  = MyConsole.GetString("\nEnter product code: ");
            String desc  = MyConsole.GetString("Enter product description: ");
            double price = MyConsole.GetDouble("Enter product price: ");

            Product p3 = new Product(code, desc, price);

            Console.WriteLine("\np3 = " + p3);

            LineItem l1 = new LineItem();

            l1.product  = p1;
            l1.quantity = 1;
            l1.total    = p1.price;

            Console.WriteLine("\nl1 = " + l1);

            Console.WriteLine("\nBye");
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Product Manager!");

            Product p1 = new Product();

            p1.code        = ".net";
            p1.description = "Murach's C# and .Net";
            p1.price       = 58.99;
            Console.WriteLine("p1 = " + p1);
            Product p2 = new Product("java", "Murach's Java Programming", 59.50);

            Console.WriteLine($"p2: {p2}");

            String  code  = MyConsole.GetString("Enter product code: ");
            String  desc  = MyConsole.GetString("Enter product description: ");
            double  price = MyConsole.GetDouble("Enter product price: ");
            Product p3    = new Product(code, desc, price);

            Console.WriteLine($"p3: {p3}");

            Console.WriteLine("Bye");
        }