using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Goods
{
private string ming;
public string Ming
{
get { return ming; }
set { ming = value; }
}
private string weizhi;
public string Weizhi
{
get { return weizhi; }
set { weizhi = value; }
}
private int manyidu;
public int Manyidu
{
get { return manyidu; }
set { manyidu = value; }
}
private double jiage;
public double Jiage
{
get { return jiage; }
set { jiage = value; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Storage
{
Goods s = new Goods();
Goods[] j = new Goods[3];
public void show1()
{
j[0] = new Goods();
j[0].Ming = "杯子";
j[0].Weizhi = "第一行第一排";
j[0].Manyidu = 99;
j[0].Jiage = 17.25;
j[1] = new Goods();
j[1].Ming = "花瓶";
j[1].Weizhi = "第六行第六排";
j[1].Manyidu = 100;
j[1].Jiage = 1000;
j[2] = new Goods();
j[2].Ming = "热水器";
j[2].Weizhi = "第八行第八排";
j[2].Manyidu = 98;
j[2].Jiage = 787;
Console.WriteLine("库存货品清单列表");
Console.WriteLine("-----------------------");
foreach (Goods i in j)
{
string a = string.Format("货币名称:{0}", i.Ming);
Console.WriteLine(a);
}
Console.WriteLine("-----------------------");
}
public void menu()
{
do
{
Console.WriteLine("=====================欢迎使用库存管理系统============================");
Console.Write("1:根据货物名称获取货品位置");
Console.Write("2:取得客户满意度最高的货品");
Console.WriteLine("3:退出");
Console.WriteLine("=====================================================================");
int shu = 0;
Console.WriteLine("请选择:");
shu = int.Parse(Console.ReadLine());
if (shu == 1)
{
sho();
}
else if (shu == 2)
{
show5();
}
else if (shu == 3)
{
Console.WriteLine("谢谢您的使用");
break;
}
else
{
Console.WriteLine("菜单输入错误,请重新输入选项");
continue;
}
} while (true);
}
private bool sho()
{
string ming = "";
Console.WriteLine("请输入项目名称:");
ming = Console.ReadLine();
bool dui = false;
foreach (Goods item in j)
{
if (ming.Equals(item.Ming))
{
dui = true;
Console.WriteLine(item.Weizhi);
}
else
{
dui = false;
Console.WriteLine("输入错误");
break;
}
}
return dui;
}
public void show5()
{
s = show4();
Console.WriteLine("客户满意度最高的货品:{0}摆放在{1}满意度{2}价格{3}", s.Ming, s.Weizhi, s.Manyidu, s.Jiage);
}
private Goods show4()
{
foreach (Goods item in j)
{
if(item.Manyidu>s.Manyidu)
{
s.Ming = item.Ming;
s.Weizhi = item.Weizhi;
s.Manyidu = item.Manyidu;
s.Jiage = item.Jiage;
}
}
return s;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Storage c = new Storage();
c.show1();
c.menu();
Console.ReadLine();
}
}
}