using System;
namespace SydneyCoffee
{
class Program
{
static void Main(string[] args)
{
// Declaring N and allocating a value
int n = 2;
// declaring arrays to store data
String[] name = new string[n];
int[] quantity = new int[n];
String[] reseller = new string[n];
double[] charge = new double[n];
double price;
double min = 9999999;
String minName = "";
double max = -1;
String maxName = "";
// Welcome message
[Link]("\t\t\t\tWelcome to use Sydney Coffee
Program\n");
// Loop to get the inputs
for (int i = 0; i < n; i++)
{
[Link]("Enter customer name: ");
name[i] = [Link]();
quantity[i] = 0;
// The loop will continue whenever the entered value
is out of range
do
{
[Link]("Enter the number of coffee beans
bags (bag/1kg): ");
quantity[i] = Convert.ToInt32([Link]());
if (quantity[i] < 1 || quantity[i] > 200)
{
[Link]("Invalid Input!\nCoffee bags
between 1 and 200 can be ordered.");
}
} while (quantity[i] < 1 || quantity[i] > 200);
// determining the price
if (quantity[i] <= 5)
{
price = 36 * quantity[i];
}
else if (quantity[i] <= 15)
{
price = 34.5 * quantity[i];
}
else
{
price = 32.7 * quantity[i];
}
[Link]("Enter yes/no to indicate whesther you
are a reseller: ");
reseller[i] = [Link]();
if (reseller[i] == "yes")
{
// 20% discount
charge[i] = price * 0.8;
}
else
{
charge[i] = price;
}
[Link]([Link]("The total sales value
from {0} is ${1}", name[i], charge[i]));
[Link]("---------------------------------------------------
--------------------------");
// finding max min value
if (min > charge[i])
{
min = charge[i];
minName = name[i];
}
if (max < charge[i])
{
max = charge[i];
maxName = name[i];
}
}
// summary heading
[Link]("\t\t\t\t\tSummary of sales\n");
[Link]("---------------------------------------------------
--------------------------");
[Link]("---------------------------------------------------
--------------------------");
// displaying table header
[Link]([Link]("{0,15}{1,10}{2,10}
{3,10}",
"Name", "Quantity", "Reseller", "Charge"));
// displaying table data
for (int i = 0; i < n; i++)
{
[Link]([Link]("{0,15}{1,10}{2,10}
{3,10}",
name[i], quantity[i], reseller[i], charge[i]));
}
[Link]("---------------------------------------------------
--------------------------");
[Link]("---------------------------------------------------
--------------------------");
[Link]([Link]("The customer spending
most is {0} ${1}", maxName, max));
[Link]([Link]("The customer spending
least is {0} ${1}", minName, min));
}
}
}