using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace five
{
class Goods
{
private string name;
private string place;
private double price;
private int satisfaction;
public string Name
{
get { return name; }
set { name = value; }
}
public string Place
{
get { return place; }
set { place = value; }
}
public double Price
{
get { return price; }
set { price = value; }
}
public int Satisfaction
{
get { return satisfaction; }
set { satisfaction = value; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace five
{
class Storage
{
Goods gaa = new Goods();
Goods[] goo = new Goods[3];
public void Initia()
{
goo[0] = new Goods();
goo[0].Name = "杯子";
goo[0].Place = "第一仓库第一排";
goo[0].Price = 88.0;
goo[0].Satisfaction = 70;
goo[1] = new Goods();
goo[1].Name = "花瓶";
goo[1].Place = "第三仓库第二排";
goo[1].Price = 188.0;
goo[1].Satisfaction = 190;
goo[2] = new Goods();
goo[2].Name = "热水器";
goo[2].Place = "第四仓库第五排";
goo[2].Price = 888.0;
goo[2].Satisfaction = 100;
}
public void show()
{
do
{
Console.WriteLine("=======================欢迎使用库存管理系统========================");
Console.WriteLine("1:根据货品名称获取物品位置\t2:取得客户满意度最高得货物\t3:退出");
Console.WriteLine("===================================================================");
Console.Write("请选择:");
int select = int.Parse(Console.ReadLine());
switch (select)
{
case 1:
bool arr = Gain();
if (arr==false)
{
Console.WriteLine("您输入的货品名称不正确!");
}
break;
case 2:
Statis();
break;
case 3:
Console.WriteLine("谢谢使用!系统退出!");
break;
default:
Console.WriteLine("菜单选择错误,请重新输入选项!");
break;
}
} while (true);
}
public bool Gain()
{
bool yes=false;
Console.Write("请输入货品名称:");
string _name = Console.ReadLine();
foreach (Goods item in goo)
{
if (_name.Equals(item.Name))
{
Console.WriteLine(item.Place);
yes = true;
}
else
{
yes = false;
}
}
return yes;
}
public void Statis()
{
gaa = Sta();
Console.WriteLine("温馨提示:");
Console.WriteLine("客户满意度最高的货品:{0}\t摆在:{1}\t满意度:{2}\t价格:{3}",gaa.Name,gaa.Place,gaa.Satisfaction,gaa.Price);
}
public Goods Sta()
{
gaa.Satisfaction = 0;
foreach (Goods item in goo)
{
if (item.Satisfaction>gaa.Satisfaction)
{
gaa.Satisfaction = item.Satisfaction;
gaa.Name = item.Name;
gaa.Place = item.Place;
gaa.Price = item.Price;
}
}
return gaa;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace five
{
class Program
{
static void Main(string[] args)
{
Storage all = new Storage();
all.Initia();
all.show();
}
}
}