当前位置:网站首页>C XX management system

C XX management system

2022-06-26 05:28:00 Elliot_ Alderson

Boy, don't be silly , Don't go to the so-called program writing group to find help

  • If you don't believe that the final assignment can be copied and pasted directly from me , You can close it .
  • It's the kind of writing that sucks XX Management system . There are still people who will pay for , And then I made a lot of money .
    I wonder if your money ever flowed into my pocket , However, the service tenet is not refundable .

The following is a recent one written by a teacher C# edition , If you think it's good, give it a compliment .

using System;
using System.Collections.Generic;

class Singleton<T> where T : new()
{
    private static T instance;
    public static T Instance
    {
        get
        {
            if (instance == null)
            {
                instance = new T();
            }
            return instance;
        }
    }
}

class AccountChache
{
    public string ID, Name;
    public override string ToString()
    {
        return "ID:" + ID + "\nName" + Name;
    }
}/// <summary>
///  Students 
/// </summary>
class Controled : AccountChache
{
    /// <summary>
    ///  The results of three courses 
    /// </summary>
    public double Chinese, English, Math;
    /// <summary>
    ///  A simple input function , Let input image Python It's as simple as inside 
    /// </summary>
    /// <param name="msg"></param>
    /// <returns></returns>
    public string Input(string msg)
    {
        Console.WriteLine(msg);
        return Console.ReadLine();
    }
    /// <summary>
    ///  Initialization function , By default, the grades of the three courses are 0
    /// </summary>
    /// <param name="id"></param>
    /// <param name="name"></param>
    /// <param name="c"></param>
    /// <param name="e"></param>
    /// <param name="m"></param>
    public Controled(string id, string name, double c = 0, double e = 0, double m = 0)
    {
        ID = id;
        Name = name;
        Chinese = c;
        English = e;
        Math = m;
    }
    /// <summary>
    ///  Output all grades 
    /// </summary>
    public void ShowAllGrades()
    {
        Console.WriteLine(" The grade of Chinese is :", Chinese);
        Console.WriteLine(" What's the math score :", Math);
        Console.WriteLine(" The English score is :", English);
    }
    /// <summary>
    ///  Output all the details of the students 
    /// </summary>
    public void ShowDetails()
    {
        Console.WriteLine(base.ToString());
        ShowAllGrades();
    }
    /// <summary>
    ///  Revise grades 
    /// </summary>
    public void SetAllGrades()
    {
        double c, e, m;
        c = Convert.ToInt32(" Please input Chinese score ");
        e = Convert.ToInt32(" Please enter your English score ");
        m = Convert.ToInt32(" Please enter the math score ");
        Chinese = c;
        Math = m;
        English = e;
        Console.WriteLine(" Modification successful , The revised results are as follows ");
        ShowAllGrades();
    }
}

/// <summary>
///  Class 
/// </summary>
class ControledManager
{
    Dictionary<int, Controled> ControledList = new Dictionary<int, Controled>();
    static int Count = 0;
    public string IDCode;
    public override string ToString()
    {
        return " There are students in this class " + Count.ToString() + " people " +" The shift number of this shift is :" + IDCode;
    }
    public ControledManager()
    {
        IDCode = Input(" Please enter the shift number ");
    }
    public string Input(string msg)
    {
        Console.WriteLine(msg);
        return Console.ReadLine();
    }
    /// <summary>
    ///  Add student 
    /// </summary>
    public void AddControledMember()
    {
        string id, name;
        id = Input(" Please enter the student number ");
        name = Input(" Please enter a name ");
        Controled controled = new Controled(id, name);
        ControledList.Add(++Count, controled);
        Console.WriteLine(" Add success ");
    }
    /// <summary>
    ///  Delete students 
    /// </summary>
    public void RemoveControledMember()
    {
        int Find_id;
        Find_id = Convert.ToInt32(Input(" Please input the students ID"));
        if (ControledList.ContainsKey(Find_id))
        {
            Console.WriteLine(ControledList[Find_id].ToString());
            string sure = Input(" Are you sure you want to delete ?(y/n)");
            if (sure == "y" || sure == "Y")
            {
                ControledList.Remove(Find_id);
                Count--;
                Console.WriteLine(" Delete successful ");
            }
        }
        else
        {
            Console.WriteLine(" Check no one ");
        }
    }
    /// <summary>
    ///  Revise student grades 
    /// </summary>
    public void ModifyControledMemberGrades()
    {
        int Find_id;
        Find_id = Convert.ToInt32(Input(" Please input the students ID"));
        if (ControledList.ContainsKey(Find_id))
        {
            Console.WriteLine(ControledList[Find_id].ToString());
            ControledList[Find_id].SetAllGrades();
        }
        else
        {
            Console.WriteLine(" Check no one ");
        }
    }
    /// <summary>
    ///  Find students 
    /// </summary>
    public void SearchControledMember()
    {
        int Find_id;
        Find_id = Convert.ToInt32(Input(" Please input the students ID"));
        if (ControledList.ContainsKey(Find_id))
        {
            ControledList[Find_id].ShowDetails();
        }
        else
        {
            Console.WriteLine(" Check no one ");
        }
    }
}


/// <summary>
///  The teacher class 
/// </summary>
class Controler : Singleton<Controler>
{
    /// <summary>
    ///  The title 
    /// </summary>
    public string Position;
    public string name;
    Dictionary<int, ControledManager> ControlerManagerList = new Dictionary<int, ControledManager>();
    static int Count = 0;
    public string Input(string msg)
    {
        Console.WriteLine(msg);
        return Console.ReadLine();
    }
    public Controler()
    {
        Position = Input(" Please enter position ");
        name = Input(" Please enter a name ");
    }
    public void AddClass()
    {
        ControledManager controledManager = new ControledManager();
        ControlerManagerList.Add(++Count, controledManager);
        Console.WriteLine(" Add success ");
        Console.ReadLine();
    }
    public void RemoveClass()
    {
        int Find_id = Convert.ToInt32(Input(" Please enter class id"));
        if (ControlerManagerList.ContainsKey(Find_id))
        {
            string sure = Input(" Delete this class ?");
            if (sure.ToUpper() == "Y")
            {
                ControlerManagerList.Remove(Find_id);
                Console.WriteLine(" Delete successful ");
            }
        }
        else
        {
            Console.WriteLine(" There is no such shift ");
        }
        Console.ReadLine();
    }
    public void ModifyClass()
    {
        Console.Clear();
        int Find_id = Convert.ToInt32(Input(" Please enter class id"));
        if (ControlerManagerList.ContainsKey(Find_id))
        {
            Console.WriteLine("1、 Add students ");
            Console.WriteLine("2、 Delete students ");
            Console.WriteLine("3、 Revise student grades ");
            Console.WriteLine("4、 Find students ");
            int i = Convert.ToInt32(Input(" Please input the operation you want to do :"));
            switch (i)
            {
                case 1:
                    ControlerManagerList[Find_id].AddControledMember();
                    break;
                case 2:
                    ControlerManagerList[Find_id].RemoveControledMember();
                    break;
                case 3:
                    ControlerManagerList[Find_id].ModifyControledMemberGrades();
                    break;
                case 4:
                    ControlerManagerList[Find_id].SearchControledMember();
                    break;
            }
        }
        else
        {
            Console.WriteLine(" There is no such shift ");
        }
        Console.ReadLine();
        Console.Clear();
    }
    public void SearchClass()
    {
        int Find_id = Convert.ToInt32(Input(" Please enter class id"));
        if (ControlerManagerList.ContainsKey(Find_id))
        {
            Console.WriteLine(ControlerManagerList[Find_id].ToString());
        }
        else
        {
            Console.WriteLine(" Check that there is no class ");
        }
        Console.ReadLine();
    }
}

public static class main
{
    public static void Main()
    {
        Controler controler = new Controler();
        
        while(true)
        {
            Console.Clear();
            Console.WriteLine(" Student information management system ");
            Console.WriteLine("1、 Add class ");
            Console.WriteLine("2、 Delete class ");
            Console.WriteLine("3、 Change the class ");
            Console.WriteLine("4、 Find the class ");
            Console.WriteLine(" Please enter the operation you need ");
            int i = Convert.ToInt32(Console.ReadLine());
            switch(i)
            {
                case 1:
                    Console.Clear();
                    controler.AddClass();
                    Console.Clear();
                    break;
                case 2:
                    Console.Clear();
                    controler.RemoveClass();
                    Console.Clear();
                    break;
                case 3:
                    Console.Clear();
                    controler.ModifyClass();
                    Console.Clear();
                    break;
                case 4:
                    Console.Clear();
                    controler.SearchClass();
                    Console.Clear();
                    break;
            }
        }
    }
}

this is it OvO

原网站

版权声明
本文为[Elliot_ Alderson]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180506069144.html