예제 #1
0
        public override string ToString()
        {
            string receipt = "";

            foreach (var p in ProductList)
            {
                receipt += (p.ToString() + "\n");
            }

            receipt += "Sales Taxes:" + TotalSalesTax.ToString("F") + "\n";
            receipt += "Total:" + TotalAmount + "\n";

            return(receipt);
        }
예제 #2
0
        public string Output()
        {
            var sb = new StringBuilder();

            foreach (var item in Receipt)
            {
                sb.AppendLine(item.Output);
            }

            // tax and total
            sb.AppendLine("Sales Taxes: " + TotalSalesTax.ToString("0.00"));
            sb.AppendLine("Total: " + TotalPrice.ToString("0.00"));

            return(sb.ToString());
        }