Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Schulnoten
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double note = 0;
  14.  
  15. while(true) {
  16. Console.WriteLine("Geben Sie die Note ein");
  17. note = Convert.ToDouble(Console.ReadLine());
  18.  
  19. if (!IsWithin(note, 1, 6))
  20. {
  21. Console.WriteLine("Bitte eine Note zwischen 1 und 6 eingeben!");
  22. }
  23.  
  24. if (IsWithin(note, 1, 1.2))
  25. {
  26. Console.WriteLine("Note: 1");
  27. }
  28. if (IsWithin(note, 1.3, 1.6))
  29. {
  30. Console.WriteLine("Note: 1-");
  31. }
  32. if (IsWithin(note, 1.7, 1.9))
  33. {
  34. Console.WriteLine("Note: 2+");
  35. }
  36. if (IsWithin(note, 2, 2.2))
  37. {
  38. Console.WriteLine("Note: 2");
  39. }
  40. if (IsWithin(note, 2.3, 2.6))
  41. {
  42. Console.WriteLine("Note: 2-");
  43. }
  44. if (IsWithin(note, 2.7, 2.9))
  45. {
  46. Console.WriteLine("Note: 3+");
  47. }
  48. if (IsWithin(note, 3, 3.2))
  49. {
  50. Console.WriteLine("Note: 3");
  51. }
  52. if (IsWithin(note, 3.3, 3.6))
  53. {
  54. Console.WriteLine("Note: 3-");
  55. }
  56. if (IsWithin(note, 3.7, 3.9))
  57. {
  58. Console.WriteLine("Note: 4+");
  59. }
  60. if (IsWithin(note, 4, 4.2))
  61. {
  62. Console.WriteLine("Note: 4");
  63. }
  64. if (IsWithin(note, 4.3, 4.6))
  65. {
  66. Console.WriteLine("Note: 4-");
  67. }
  68. if (IsWithin(note, 4.7, 4.9))
  69. {
  70. Console.WriteLine("Note: 5+");
  71. }
  72. if (IsWithin(note, 5, 5.2))
  73. {
  74. Console.WriteLine("Note: 5");
  75. }
  76. if (IsWithin(note, 5.3, 5.6))
  77. {
  78. Console.WriteLine("Note: 5-");
  79. }
  80. if (IsWithin(note, 5.7, 5.9))
  81. {
  82. Console.WriteLine("Note: 6+");
  83. }
  84. if (IsWithin(note, 6, 7))
  85. {
  86. Console.WriteLine("Note: 6");
  87. }
  88. Console.ReadLine();
  89. Console.Clear();
  90. }
  91. }
  92. public static bool IsWithin(double value, double minimum, double maximum)
  93. {
  94. return value >= minimum && value <= maximum;
  95. }
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement