using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store
{
class Program
{
static void Main(string[] args)
{
int capacity;
do
{
capacity = 0;
Console.Write("Please eneter the number of the clients: ");
try
{
capacity = Int32.Parse(Console.ReadLine());
}
catch (Exception)
{
Console.WriteLine("Please be nice!!!");
}
} while (capacity > 500 || capacity < 1);
Customer[] customers = new Customer[capacity];
for (var i = 0; i < capacity; i++)
{
customers[i] = InputCustomer();
}
}
public static Customer InputCustomer()
{
Customer customer = new Customer();
customer.FullName = InputStringWithlenght("Full Name", 30);
customer.Town = InputStringWithlenght("Town", 10);
customer.Town = InputStringWithlenght("Code", 10);
return customer;
}
public static string InputStringWithlenght(string itemName, int lenght)
{
string item;
do
{
Console.Write("Please, enter {0} (max lenght {1}): ", itemName, lenght);
item = Console.ReadLine();
} while (item.Length > lenght);
return item;
}
}
}
Comments