Write a program in C# Sharp to accept a grade and declare the equivalent description

  • برمجة سي شارب
  • برمجة

Write a program in C# Sharp to accept a grade and declare the equivalent description :

Sample Output:

Accept a grade and display equivalent description:                                                            
---------------------------------------------------                                                           
Input the grade :V                                                                                            
You have chosen  :  Very Good

Grade Description
E Excellent
V Very Good
G Good
A Average
F Fail

 

 

 

 

 

 

الأجوبة

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
public   class exercise19
   {
       static void Main(string[] args)
    {
    string notes;
    char grd;
          Console.Write("\n\n");
           Console.Write("Accept a grade and display equivalent description:\n");
           Console.Write("---------------------------------------------------");
           Console.Write("\n\n");

 
    Console.Write("Input the grade :");
    grd = Convert.ToChar(Console.ReadLine().ToUpper());

    switch(grd)
    {
    case 'E':
        notes= " Excellent";
        break;
    case 'V':
       notes= " Very Good";
        break;
    case 'G':
        notes= " Good ";
        break;
    case 'A':
        notes= " Average";
        break;
    case 'F':
        notes= " Fails";
        break;
    default :
        notes= "Invalid Grade Found.";
        break;
    }
    Console.Write("You have chosen  : {0}\n", notes);
} 
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...