Design the C console application program for the XManufactur
Design the C# console application program for the XManufacturing System prototype.
ABC Inc makes Widget X. You are responsible to make a new system that tracks all the components that make widget X such a successful product. Widget X is comprised of the following components; Component PART G, H, I , J and K. There is also a special Limited Edition Widget X that uses special components L & M. Every Widget X is personally inspected by ABC shop tech before it is boxed and shipped out.
Program the C# classes with the following properties
Widget_X class with 2 properties; sku-ID & date-MFG
Part_G class with one property; batch-ID
Part_L class with two properties; batch-ID and inspector-ID
Create a menu system that allows the user to create object out of the 3x classes (see 10/6 class programming note).
Instantiate the following object out of the above classes in your C# program.
Widget_X_01 ; sku-ID (8712) date-MFG (10/10/2016)
Part_G_X ; batch-ID (102016)
Part_L_X; batch-ID (201023) inspector-ID (Emp8711)
Solution
using System;
namespace Widget
{
class Widget_X
{
private int sku_ID;
private string date_MFG;
public Widget_X(int id, string mfg)
{
sku_ID = id;
date_MFG=mfg;
}
public string getDate_MFG()
{
return date_MFG;
}
public int getSku_ID()
{
return sku_ID;
}
}
class Part_G_X
{
private int batch_ID;
public Part_G_X(int bid)
{
batch_ID = bid;
}
public int getBatch_ID()
{
return batch_ID;
}
}
class Part_L_X
{
private int batch_ID;
private string inspector_ID;
public Part_L_X(int bid,string iid)
{
batch_ID = bid;
inspector_ID=iid;
}
public int getBatch_ID()
{
return batch_ID;
}
public string getInspector_ID()
{
return inspector_ID;
}
}
class Program{
static void Main(string[] args)
{
while(true)
{
Console.WriteLine(\"1. Create object of Widget_X\");
Console.WriteLine(\"2. Create object of Part_G_X\");
Console.WriteLine(\"3. Create object of Part_L_X\");
Console.WriteLine(\"4. Exit\");
Console.WriteLine(\"Enter your choice: \");
int ch=Convert.ToInt32(Console.ReadLine());
if(ch==1)
{ Widget_X Widget_X_01=new Widget_X(8712,\"10/10/2016\");
Console.WriteLine(\"Widget_X object is created\");
Console.WriteLine(\"Sku_ID: \"+Widget_X_01.getSku_ID());
Console.WriteLine(\"Date of MFG: \"+Widget_X_01.getDate_MFG());
}
else if(ch==2)
{ Part_G_X Part_G_X_01=new Part_G_X(102016);
Console.WriteLine(\"Part_G_X object is created\");
Console.WriteLine(\"Batch ID: \"+Part_G_X_01.getBatch_ID());
}
else if(ch==3)
{ Part_L_X Part_L_X_01=new Part_L_X(201023,\"Emp8711\");
Console.WriteLine(\"Part_L_X object is created\");
Console.WriteLine(\"Batch ID: \"+Part_L_X_01.getBatch_ID());
Console.WriteLine(\"Inspector ID: \"+Part_L_X_01.getInspector_ID());
}
else
{
break;
}
}
Console.ReadKey();
}
}
}

