Arithmetic Operations - Example

This section provides a tutorial example on how to use arithmetic operations: Multiplication, Division, Addition, and Subtraction.

Now let's practice what we have learned so far with a simple program to simulate the cash register in a grocery store:

```// Cashier.cs

class Cashier {
public static void Main() {
double total;

qty_milk = 2;
qty_coke = 6;
price_milk = 1.99;
price_coke = 0.99;

total = qty_milk * price_milk;
total = total + qty_coke * price_coke;

System.Console.WriteLine("Receipt");
System.Console.WriteLine(" ");
System.Console.WriteLine(
"Product     Price  Quantity  Sub-total");
System.Console.WriteLine(
"Mike 2% 2L   {0}         {1}       {2}",
price_milk, qty_milk, qty_milk*price_milk);
System.Console.WriteLine(
System.Console.WriteLine(
"Coke 2L      {0}         {1}       {2}",
price_coke, qty_coke, qty_coke*price_coke);
System.Console.WriteLine(" ");
System.Console.WriteLine(
"Total:                           {0}",
total);
}
}
```

Output of the program will be:

```Receipt

Product     Price  Quantity  Sub-total
Mike 2% 2L   1.99         2       3.98