fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _6._2tt
  8. {
  9. internal class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double price, total;
  14. Console.WriteLine("******************************");
  15. Console.WriteLine(" Program Grade ");
  16. Console.WriteLine("******************************");
  17. // Input student details
  18. Console.Write("Enter student code: ");
  19. string CODE = Console.ReadLine();
  20.  
  21. Console.Write("Enter student name: ");
  22. string NAME = Console.ReadLine();
  23.  
  24. Console.Write("Enter test score (0-20): ");
  25. double TEST = double.Parse(Console.ReadLine());
  26.  
  27. Console.Write("Enter midterm score (0-30): ");
  28. double MIDTERM = double.Parse(Console.ReadLine());
  29.  
  30. Console.Write("Enter final score (0-50): ");
  31. double FINAL = double.Parse(Console.ReadLine());
  32.  
  33. // Calculate total score
  34. double TOTALSCORE = TEST + MIDTERM + FINAL;
  35.  
  36. // Determine the grade
  37. string GRADE;
  38. if (TOTALSCORE >= 80 && TOTALSCORE <= 100)
  39. {
  40. GRADE = "A";
  41. }
  42. else if (TOTALSCORE >= 75 && TOTALSCORE <= 79)
  43. {
  44. GRADE = "B+";
  45. }
  46. else if (TOTALSCORE >= 70 && TOTALSCORE <= 74)
  47. {
  48. GRADE = "B";
  49. }
  50. else if (TOTALSCORE >= 65 && TOTALSCORE <= 69)
  51. {
  52. GRADE = "C+";
  53. }
  54. else if (TOTALSCORE >= 60 && TOTALSCORE <= 64)
  55. {
  56. GRADE = "C";
  57. }
  58. else if (TOTALSCORE >= 55 && TOTALSCORE <= 59)
  59. {
  60. GRADE = "D+";
  61. }
  62. else if (TOTALSCORE >= 50 && TOTALSCORE <= 54)
  63. {
  64. GRADE = "D";
  65. }
  66. else
  67. {
  68. GRADE = "F";
  69. }
  70.  
  71. // Display results
  72. Console.WriteLine("\n===== Student Grade Report =====");
  73. Console.WriteLine("Student Code: " + CODE);
  74. Console.WriteLine("Student Name: " + NAME);
  75. Console.WriteLine("Test Score: " + TEST);
  76. Console.WriteLine("Midterm Score: " + MIDTERM);
  77. Console.WriteLine("Final Score: " + FINAL);
  78. Console.WriteLine("Total Score: " + TOTALSCORE);
  79. Console.WriteLine("Grade: " + GRADE);
  80. }
  81. }
  82. }
  83.  
Success #stdin #stdout 0.03s 25800KB
stdin
Standard input is empty
stdout
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _6._2tt
{
    internal class Program
    {
        static void Main(string[] args)
        {
            double price, total;
            Console.WriteLine("******************************");
            Console.WriteLine("         Program Grade        ");
            Console.WriteLine("******************************");
            // Input student details
            Console.Write("Enter student code: ");
            string CODE = Console.ReadLine();

            Console.Write("Enter student name: ");
            string NAME = Console.ReadLine();

            Console.Write("Enter test score (0-20): ");
            double TEST = double.Parse(Console.ReadLine());

            Console.Write("Enter midterm score (0-30): ");
            double MIDTERM = double.Parse(Console.ReadLine());

            Console.Write("Enter final score (0-50): ");
            double FINAL = double.Parse(Console.ReadLine());

            // Calculate total score
            double TOTALSCORE = TEST + MIDTERM + FINAL;

            // Determine the grade
            string GRADE;
            if (TOTALSCORE >= 80 && TOTALSCORE <= 100)
            {
                GRADE = "A";
            }
            else if (TOTALSCORE >= 75 && TOTALSCORE <= 79)
            {
                GRADE = "B+";
            }
            else if (TOTALSCORE >= 70 && TOTALSCORE <= 74)
            {
                GRADE = "B";
            }
            else if (TOTALSCORE >= 65 && TOTALSCORE <= 69)
            {
                GRADE = "C+";
            }
            else if (TOTALSCORE >= 60 && TOTALSCORE <= 64)
            {
                GRADE = "C";
            }
            else if (TOTALSCORE >= 55 && TOTALSCORE <= 59)
            {
                GRADE = "D+";
            }
            else if (TOTALSCORE >= 50 && TOTALSCORE <= 54)
            {
                GRADE = "D";
            }
            else
            {
                GRADE = "F";
            }

            // Display results
            Console.WriteLine("\n===== Student Grade Report =====");
            Console.WriteLine("Student Code: " + CODE);
            Console.WriteLine("Student Name: " + NAME);
            Console.WriteLine("Test Score: " + TEST);
            Console.WriteLine("Midterm Score: " + MIDTERM);
            Console.WriteLine("Final Score: " + FINAL);
            Console.WriteLine("Total Score: " + TOTALSCORE);
            Console.WriteLine("Grade: " + GRADE);
        }
    }
}