That night, we typed out the inventory management system.

Source: Internet
Author: User

That night, we typed out the inventory management system.

Will you see me later? No matter where you are> maybe you are in a warm home, maybe you are in a different city; maybe you are singing at the top of the peak, maybe you are still trying to climb the steep mountain ....... I believe that we will all go to the top of the summit, "the peak will be the peak, and the mountains will be small "..

Share with you today ==> Inventory Management System

(Part ):

 

01. First, we need to create a repository class and define some attributes>

Using System; using System. collections. generic; using System. linq; using System. text; using System. threading. tasks; namespace Day01 {public class Goods {// public string name; public string difang; public double price; public double high ;}}

02. Then we create a customer class>

 

Using System; using System. collections. generic; using System. linq; using System. text; using System. threading. tasks; namespace Day01 {public class Custor {Goods [] goods = new Goods [3]; public void Initial () {// 01. value of the array // 1 Goods goods1 = new Goods (); goods1.name = "sunflower Collection"; goods1.difang = "Heaven"; goods1.price = 1.28; goods1.high = 90; goods [0] = goods1; // 2 Goods goods2 = new Goods (); goods2.name = "Gu JIU Jian "; Goods2.difang = ""; goods2.price = 3.50; goods2.high = 90; goods [1] = goods2; // 3 Goods goods3 = new Goods (); goods3.name = ""; goods3.difang = ""; goods3.price = 12.65; goods3.high = 90; goods [2] = goods3;} public void ShowMenu () {// 02. output the artifact list Console. writeLine ("===== list of artifacts ====>>>"); Console. writeLine (); foreach (Goods item in goods) {if (item! = Null) {Console. writeLine ("item name: {0}", item. name); Console. writeLine ("========================== ");}}} public void Welcome () {Console. writeLine ("===== welcome to use the artifact system ====>>>"); Console. writeLine ("1. obtain the artifact address based on the artifact name. 2. goods with the highest customer satisfaction 3. exit "); Console. writeLine ("select:"); int num = int. parse (Console. readLine (); switch (num) {case 1: // getgoodsphistory (); break; case 2: Console. writeLine (); break; case 3: Cons Ole. writeLine ("exit"); break;} public void getgoodspfailed () {// 03. query the location bool flag1 = false; Console. writeLine ("Enter the product name:"); string name1 = Console. readLine (); for (int I = 0; I <goods. length; I ++) {if (goods [I]. name = name1) {flag1 = true; goods [I]. high ++; Console. writeLine ("this artifact is at: {0}", goods [I]. difang); Console. writeLine ("automatic conversion to master page ==>>"); Welcome (); break ;}}if (flag1 = false) {Console. writeLi Ne ("No such artifact! "); Console. WriteLine (" automatic conversion to master page ==>> "); Welcome () ;}} public void GetMaxPleased ()
{// 04. obtain customer satisfaction (when satisfaction is the same) if (goods [0]. high> goods [1]. high & goods [1]. high> = goods [2]. high | goods [0]. high> = goods [1]. high & goods [1]. high> goods [2]. high) {Console. writeLine ("goods with the highest customer satisfaction: {0} \ t placed at: {1} \ t satisfaction: {2} \ t price: {3 }", goods [0]. name, goods [0]. difang, goods [0]. high, goods [0]. price);} if (goods [0]. high = goods [1]. high & goods [1]. high = goods [2]. high) {Console. writeLine ("failed to judge the highest satisfaction! Their satisfaction is: {0} ", goods [0]. high);} if (goods [1]. high> goods [0]. high & goods [0]. high> = goods [2]. high | goods [1]. high> = goods [0]. high & goods [0]. high> goods [2]. high) {Console. writeLine ("goods with the highest customer satisfaction: {0} \ t placed at: {1} \ t satisfaction: {2} \ t price: {3 }", goods [1]. name, goods [1]. difang, goods [1]. high, goods [1]. price);} if (goods [2]. high> goods [0]. high & goods [0]. high> = goods [1]. high | goods [2]. high> = goods [0]. high & goods [0]. high> goods [1]. high) {Console. writeLine ("goods with the highest customer satisfaction: {0} \ t placed at: {1} \ t satisfaction: {2} \ t price: {3 }", goods [2]. name, goods [2]. difang, goods [2]. high, goods [2]. price);} if (goods [0]. high> goods [2]. high & goods [2]. high> = goods [1]. high | goods [0]. high> = goods [2]. high & goods [2]. high> goods [1]. high) {Console. writeLine ("goods with the highest customer satisfaction: {0} \ t placed at: {1} \ t satisfaction: {2} \ t price: {3 }", goods [0]. name, goods [0]. difang, goods [0]. high, goods [0]. price );}}}}

 

 

02-2 are you in trouble? Maybe you will spend a long time. Don't do this. teach you a simple method (when satisfaction is different ):

 

// 01. first, first give satisfaction goods [I]. assign different values to high: public double GetMaxPleased2 () {// 02. find the maximum value for (int I = 0; I <goods. length-1; I ++) {for (int j = 0; j <goods. length-1-i; j ++) {if (goods [j]. high> goods [j + 1]. high) {double temp = goods [j]. high; goods [j]. high = goods [j + 1]. high; goods [j + 1]. high = temp ;}} return goods [2]. high; // returns the maximum value // 03. finally, the main method receives and outputs .......}

 

Is there a sense of openness? No thanks. It may not be worth mentioning in the eyes of your experts ...... sorry!

03. Finally, we can call the main method>

 

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Day01{   public class Program    {        static void Main(string[] args)        {            Custor custor = new Custor();            custor.Initial();            custor.ShowMenu();            custor.Welcome();            Console.ReadLine();        }    }}

 

Thank you! My dear friends! If you have any suggestions or suggestions,Hope to enlighten me!

Time is limited. Next floor !!!!!!!

QQ: 1907832004

E: 5212504881@163.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.