JulianJulianov

02.MethodsLab-Grades

Feb 11th, 2020
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. 2. Grades
  2. Write a method that receives a grade between 2.00 and 6.00 and prints the corresponding grade in words
  3. • 2.00 – 2.99 - "Fail"
  4. • 3.00 – 3.49 - "Poor"
  5. • 3.50 – 4.49 - "Good"
  6. • 4.50 – 5.49 - "Very good"
  7. • 5.50 – 6.00 - "Excellent"
  8. Examples
  9. Input Output
  10. 3.33 Poor
  11. 4.50 Very good
  12. 2.99 Fail
  13.  
  14. using System;
  15.  
  16. namespace _02MethodsLabGrades
  17. {
  18. class Program
  19. {
  20. static void Main(string[] args)
  21. {
  22. var grade = double.Parse(Console.ReadLine());
  23. PrintAsWords(grade);
  24. }
  25. static void PrintAsWords(double grade)
  26. {
  27. if (grade >= 2.00 && grade <= 2.99)
  28. {
  29. Console.WriteLine("Fail");
  30. }
  31. else if (grade >= 3.00 && grade <= 3.49)
  32. {
  33. Console.WriteLine("Poor");
  34. }
  35. else if (grade >= 3.50 && grade <= 4.49)
  36. {
  37. Console.WriteLine("Good");
  38. }
  39. else if (grade >= 4.50 && grade <= 5.49)
  40. {
  41. Console.WriteLine("Very good");
  42. }
  43. else if(grade >= 5.50 && grade <= 6.00)
  44. {
  45. Console.WriteLine("Excellent");
  46. }
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment