Md Nayeem

Md Nayeem

  • NA
  • 75
  • 23.9k

Where is fault in my Program and output is not Displaying

Mar 31 2017 6:04 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SalesInformationApp
{
class Program
{
static void Main(string[] args)
{
Program s = new Program();
List<SalesInfo> InfoList = s.GetSales();
Console.WriteLine("--------Sales Information--------------");
Console.WriteLine("SID\tPID\tPName\tCustomerName\tUprice\tNopro\tTPrice");
foreach (SalesInfo pr in InfoList)
{
Console.WriteLine(pr.SID.ToString() + "\t"+ pr.PID.ToString()+"\t" + pr.PName + "\t" +pr.CustomerName+"\t"+pr.UPrice+"\t"+pr.Nopro+"\t"+pr.TPrice) ;
}
Console.ReadKey();
}
public List<SalesInfo> GetSales()
{
List<SalesInfo> InfoList = new List<SalesInfo>();
//----------------------------------Computer--------------------------------------
SalesInfo list = new SalesInfo();
list.SID = 1;
list.PID = 1;
list.PName = "Mouse";
list.CustomerName = "Md.Belal";
list.UPrice = 300.00M;
list.Nopro = 2;
list.TPrice = 600;
SalesInfo list1 = new SalesInfo();
list1.SID = 2;
list1.PID = 2;
list1.PName = "Monitor";
list1.CustomerName = "Md.Helal";
list1.UPrice = 5000.00M;
list1.Nopro = 3;
list1.TPrice = 15000;
SalesInfo list2 = new SalesInfo();
list2.SID = 3;
list2.PID = 3;
list2.PName = "Ram";
list2.CustomerName = "Md.Rasel";
list2.UPrice = 1500.00M;
list2.Nopro = 3;
list2.TPrice = 4500;
SalesInfo list3 = new SalesInfo();
list3.SID = 4;
list3.PID = 4;
list3.PName = "KeyBoard";
list3.CustomerName = "Md.Karim";
list3.UPrice = 5000.00M;
list3.Nopro = 4;
list3.TPrice = 20000;
SalesInfo list4 = new SalesInfo();
list4.SID = 5;
list4.PID = 5;
list4.PName = "Processor";
list4.CustomerName = "Md.Dulal";
list4.UPrice = 6000.00M;
list4.Nopro = 5;
list4.TPrice = 30000;
SalesInfo list5 = new SalesInfo();
list5.SID = 6;
list5.PID = 6;
list5.PName = "Ups";
list5.CustomerName = "Md.Rahim";
list5.UPrice = 7000.00M;
list5.Nopro = 5;
list5.TPrice = 35000;
SalesInfo list6 = new SalesInfo();
list6.SID = 7;
list6.PID = 7;
list6.PName = "SoundCard";
list6.CustomerName = "Md.Sobhan";
list6.UPrice = 1800.00M;
list6.Nopro = 7;
list6.TPrice = 12600;
SalesInfo list7 = new SalesInfo();
list7.SID = 8;
list7.PID = 8;
list7.PName = "MotherBoard";
list7.CustomerName = "Md.Khalid";
list7.UPrice = 10000.00M;
list7.Nopro = 7;
list7.TPrice = 70000;
SalesInfo list8 = new SalesInfo();
list8.SID = 9;
list8.PID = 9;
list8.PName = "MousePad";
list8.CustomerName = "Md.Rais";
list8.UPrice = 250.00M;
list8.Nopro = 9;
list8.TPrice = 2250;
SalesInfo list10 = new SalesInfo();
list10.SID = 10;
list10.PID = 10;
list10.PName = "Scanner";
list10.CustomerName = "Md.Talha";
list10.UPrice = 6000.00M;
list10.Nopro = 2;
list10.TPrice = 12000;
return InfoList;
}
}
/// <summary>
///
/// </summary>
public class SalesInfo
{
public int SID { get; set; }
public int PID { get; set; }
public string PName { get; set; }
public string CustomerName { get; set; }
public decimal UPrice { get; set; }
public decimal Nopro { get; set; }
public decimal TPrice { get; set; }
}
}

Answers (3)