using System.Collections.Generic;
using System.Threading.Tasks;
namespace ConsoleApplication7
private string first_name;
private string last_name;
public Order[] order { get; set; }
first_name = string.IsNullOrEmpty(value) ? "Name cannot be null or empty" : value;
return string.IsNullOrEmpty(this.first_name) ? "No name is given" : this.first_name;
last_name = string.IsNullOrEmpty(value) ? "Name cannot be null or empty" : value;
return string.IsNullOrEmpty(this.last_name) ? "No name is given" : this.last_name;
public int quantity { get; set; }
public Vehicle vehicle { get; set; }
this.price = (value <= 0) ? float.Parse("Price shouldn't be zero or negative") : value;
public string Description { get; set; }
public int Wheels { get; set; }
public int HP { get; set; }
public double Length{ get; set; }
public double Width{ get; set; }
public double Height{ get; set; }
public double Radius{ get; set; }
public virtual double CargoCap()
public class Automobile : Vehicle
public override double CargoCap()
return Length * Width * Height;
public class Motorcycle : Vehicle
public override double CargoCap()
return Math.PI * (Radius * Radius) * Height * 2;
public static void Main(string[] args)
Customer[] customer = new Customer[4];
customer[0] = new Customer { FirstName = "Joe", LastName = "Smith", order = new Order[2] };
Description = "Honda CD-70",
customer[0].order[0] = item1;
customer[0].order[1] = item2;
customer[1] = new Customer { FirstName = "Muhammad", LastName = "Abbasi", order = new Order[2] };
Description = "Honda Civic",
customer[1].order[0] = item3;
Description = "Honda 125"
customer[1].order[1] = item4;
using(StreamWriter writer = new StreamWriter("file.txt"))
writer.WriteLine("======================================= PURCHASE ORDER RECORDING SYSTEM ================================== \n");
foreach (var cust in customer)
writer.WriteLine("Customer Name: {0,10} {1,20}", cust.FirstName, cust.LastName);
writer.WriteLine("=================================================================================================\n");
writer.WriteLine("Description Price Quantity Horse Power No. of Wheels Cargo Capacity");
writer.WriteLine("----------- ----- -------- ----------- ------------- --------------\n");
foreach (var ord in cust.order)
writer.WriteLine("{0,10}{1,11} {2,12} {3,15} {4,16} {5,25} ", ord.vehicle.Description, ord.Price, ord.quantity,
ord.vehicle.HP, ord.vehicle.Wheels,