22
1
using System;
2
using System.Collections.Generic;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
Queue<string> strQ = new Queue<string>();
9
strQ.Enqueue("H");
10
strQ.Enqueue("e");
11
strQ.Enqueue("l");
12
strQ.Enqueue("l");
13
strQ.Enqueue("o");
14
15
Console.WriteLine("Total elements: {0}", strQ.Count); //prints 5
16
17
while (strQ.Count > 0)
18
Console.WriteLine(strQ.Dequeue()); //prints Hello
19
20
Console.WriteLine("Total elements: {0}", strQ.Count); //prints 0
21
}
22
}
Cached Result
Customers and orders sorted by last name:
Kevin Costner
Orders:
Jacket, Price: 230.14, Quantity: 1
Pants, Price: 70.56, Quantity: 1
Phone, Price: 130.25, Quantity: 1
Mary Jane
Orders:
Pants, Price: 70.56, Quantity: 1
Scarf, Price: 23.69, Quantity: 1
Shirt, Price: 49.99, Quantity: 1
Jane Kendall
Orders:
Car, Price: 24200.15, Quantity: 1
Scarf, Price: 23.69, Quantity: 1
Shirt, Price: 49.99, Quantity: 1
Donna Lynn
Orders:
Car, Price: 24200.15, Quantity: 1
Computer, Price: 650.00, Quantity: 1
Shoes, Price: 150.23, Quantity: 1
Eve Shrimp
Orders:
Car, Price: 24200.15, Quantity: 1
Computer, Price: 650.00, Quantity: 1
Scarf, Price: 23.69, Quantity: 1
Joe Smith
Orders:
Jacket, Price: 230.14, Quantity: 1
Phone, Price: 130.25, Quantity: 1
Shoes, Price: 150.23, Quantity: 1
Sally Smuthers
Orders:
Jacket, Price: 230.14, Quantity: 1
Pants, Price: 70.56, Quantity: 1
Shirt, Price: 49.99, Quantity: 1
Sarah Spicer
Orders:
Computer, Price: 650.00, Quantity: 1
Jacket, Price: 230.14, Quantity: 1
Pants, Price: 70.56, Quantity: 1
Total number of orders: 24
Number of orders $500 or under: 18
Number of orders over $500: 6
Total cost for all orders: 76535.25
Total cost for all orders for people 30 or under: 1812.01
Total cost for all orders for people over 30: 74723.24
The 3 least expensive products:
Scarf 23.69
Shirt 49.99
Pants 70.56
The 3 most expensive products:
Car 24200.15
Computer 650.00
Jacket 230.14
>
Kevin Costner
Orders:
Jacket, Price: 230.14, Quantity: 1
Pants, Price: 70.56, Quantity: 1
Phone, Price: 130.25, Quantity: 1
Mary Jane
Orders:
Pants, Price: 70.56, Quantity: 1
Scarf, Price: 23.69, Quantity: 1
Shirt, Price: 49.99, Quantity: 1
Jane Kendall
Orders:
Car, Price: 24200.15, Quantity: 1
Scarf, Price: 23.69, Quantity: 1
Shirt, Price: 49.99, Quantity: 1
Donna Lynn
Orders:
Car, Price: 24200.15, Quantity: 1
Computer, Price: 650.00, Quantity: 1
Shoes, Price: 150.23, Quantity: 1
Eve Shrimp
Orders:
Car, Price: 24200.15, Quantity: 1
Computer, Price: 650.00, Quantity: 1
Scarf, Price: 23.69, Quantity: 1
Joe Smith
Orders:
Jacket, Price: 230.14, Quantity: 1
Phone, Price: 130.25, Quantity: 1
Shoes, Price: 150.23, Quantity: 1
Sally Smuthers
Orders:
Jacket, Price: 230.14, Quantity: 1
Pants, Price: 70.56, Quantity: 1
Shirt, Price: 49.99, Quantity: 1
Sarah Spicer
Orders:
Computer, Price: 650.00, Quantity: 1
Jacket, Price: 230.14, Quantity: 1
Pants, Price: 70.56, Quantity: 1
Total number of orders: 24
Number of orders $500 or under: 18
Number of orders over $500: 6
Total cost for all orders: 76535.25
Total cost for all orders for people 30 or under: 1812.01
Total cost for all orders for people over 30: 74723.24
The 3 least expensive products:
Scarf 23.69
Shirt 49.99
Pants 70.56
The 3 most expensive products:
Car 24200.15
Computer 650.00
Jacket 230.14