Advertisement
farahfresnido

HOA3!!

Dec 12th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. int choice, quiznumber;
  2. double classStanding, sumofscores, sumofHPS;
  3.  
  4. choice = 0;
  5. List<int> scores = new List<int>();
  6. List<int> HPSs = new List<int>();
  7.  
  8. while (choice < 5)
  9. {
  10. Console.WriteLine("------------------------");
  11. Console.WriteLine("1 - Add Quiz");
  12. Console.WriteLine("2 - View Quiz");
  13. Console.WriteLine("3 - Corrections");
  14. Console.WriteLine("4 - View All Quizzes");
  15. Console.WriteLine("5 - Exit");
  16. Console.WriteLine("------------------------");
  17.  
  18. Console.Write("Enter choice: ");
  19. choice = int.Parse(Console.ReadLine());
  20.  
  21. if (choice == 1)
  22. {
  23. Console.WriteLine("NEW QUIZ");
  24.  
  25. Console.Write("Enter score: ");
  26. scores.Add(int.Parse(Console.ReadLine()));
  27.  
  28. Console.Write("Enter HPS: ");
  29. HPSs.Add(int.Parse(Console.ReadLine()));
  30.  
  31. Console.WriteLine("Quiz " + scores.Count + " successfully added!");
  32. }
  33. if (choice == 2)
  34. {
  35. Console.WriteLine("VIEW QUIZ");
  36. Console.Write("Enter quiz number: ");
  37. quiznumber = int.Parse(Console.ReadLine());
  38.  
  39. if (quiznumber <= scores.Count)
  40. {
  41. Console.WriteLine("Score: " + scores[quiznumber - 1] + "\tHPS: " + HPSs[quiznumber - 1]);
  42. }
  43. else
  44. {
  45. Console.WriteLine("Quiz " + quiznumber + " does not exist.");
  46. }
  47.  
  48. }
  49. if (choice == 3)
  50. {
  51. Console.WriteLine("CORRECTIONS");
  52. Console.Write("Enter quiz number: ");
  53. quiznumber = int.Parse(Console.ReadLine());
  54.  
  55. Console.Write("Enter new score: ");
  56. scores[quiznumber - 1] = int.Parse(Console.ReadLine());
  57.  
  58. Console.WriteLine("Quiz " + quiznumber + " has been successfully updated!");
  59. }
  60. if (choice == 4)
  61. {
  62. Console.WriteLine("CLASS STANDING");
  63. for (int i = 0; i < scores.Count; i++)
  64. {
  65. Console.WriteLine("Quiz " + (i + 1) + "\tScore: " + scores[i] + "\tHPS: " + HPSs[i]);
  66. }
  67.  
  68. sumofscores = (scores.Sum() / scores.Count);
  69. sumofHPS = (HPSs.Sum() / HPSs.Count);
  70.  
  71. classStanding = (sumofscores / sumofHPS) * 100;
  72.  
  73. Console.WriteLine("Class standing: " + classStanding);
  74. }
  75. }
  76. if (choice == 5)
  77. {
  78. Console.WriteLine("Exiting the app...");
  79. Console.ReadKey();
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement