C#------成绩判定

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{

    public class Score
	{
		double fenshu;
	

        public Score(double fenshu)
        {
            this.fenshu = fenshu;
        }

        public string getrank()
		{
          if(fenshu>90&&fenshu<=100)
            {
                return "优秀";
            }
            else if (fenshu > 80 && fenshu <= 90)
            {
                return "良好";
            }
            else if (fenshu > 60 && fenshu <= 80)
            {
                return "合格";
            }
            else 
            {
                return "不合格";
            }
        }

	}
 

    class Program
    {
        static void Main(string[] args)
        {
            double fenshu = double.Parse(Console.ReadLine()); 
           
            Score sc = new Score(fenshu);
            Console.WriteLine(sc.getrank());
          
            Console.Read();
        }
    }
}

你可能感兴趣的:(C#,c#)