Exemple #1
0
        public static void salesSummary(BookInventory b, ArrayList a)
        {
            double retailTotal = 0, wholesaleTotal = 0, profitTotal = 0;

            BookSales[] temp = new BookSales[a.Count];
            Console.WriteLine();
            Console.WriteLine("RETAIL                 WHOLESALE                 PROFIT");
            Console.WriteLine("---------------------------------------------------------------------");
            for (int num = 0; num < a.Count; num++)
            {
                temp[num] = (BookSales)a[num];
            }
            for (int x = 0; x < temp.Length; x++)
            {
                for (int y = 0; y < Books.Counter; y++)
                {
                    if (temp[x].Isbn == b[y].Isbn)
                    {
                        Console.WriteLine("{0,20:C} {1,20:C} {2,20:C}", b[y].CalculateRetail, b[y].WholesaleCost, (b[y].CalculateRetail - b[y].WholesaleCost));
                        profitTotal    = profitTotal + (b[y].CalculateRetail - b[y].WholesaleCost);
                        wholesaleTotal = wholesaleTotal + b[y].WholesaleCost;
                        retailTotal    = retailTotal + b[y].CalculateRetail;
                    }
                }
            }
            Console.WriteLine();
            Console.WriteLine("TOTAL");
            Console.WriteLine("---------------------------------------------------------------------");
            Console.WriteLine("{0,20:C} {1,20:C} {2,20:C}", retailTotal, wholesaleTotal, profitTotal);
            Console.WriteLine();
        }
Exemple #2
0
 public static void listSales(BookInventory b, ArrayList a)
 {
     Console.WriteLine();
     BookSales[] temp = new BookSales[a.Count];
     for (int num = 0; num < a.Count; num++)
     {
         temp[num] = (BookSales)a[num];
     }
     Console.WriteLine("TITLE                         COST");
     Console.WriteLine("------------------------------------------");
     for (int x = 0; x < temp.Length; x++)
     {
         for (int y = 0; y < Books.Counter; y++)
         {
             if (temp[x].Isbn == b[y].Isbn)
             {
                 Console.WriteLine("{0,-35} {1,5:C}", b[y].Title, b[y].CalculateRetail);
             }
         }
     }
     Console.WriteLine();
 }