Advertisement
Kenkaster001

HOA QUIZ

Jul 24th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 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 HOA3_12Eva03AmadorJohnMichael
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int choice = 0, score, hps, quiznum, nScore;
  14. List<int> iScores = new List<int>();
  15. List<int> iHps = new List<int>();
  16. while (choice == 0)
  17. {
  18. Console.WriteLine("----------------------");
  19. Console.WriteLine("1 - Add Quiz");
  20. Console.WriteLine("2 - View Quiz");
  21. Console.WriteLine("3 - Corrections");
  22. Console.WriteLine("4 - View All Quizzes");
  23. Console.WriteLine("5 - Exit");
  24. Console.WriteLine("----------------------");
  25. Console.Write("Enter choice: ");
  26. choice = int.Parse(Console.ReadLine());
  27. if (choice == 1)
  28. {
  29. Console.WriteLine("NEW QUIZ");
  30. Console.Write("Enter score: ");
  31. score = int.Parse(Console.ReadLine());
  32. iScores.Add(score);
  33. Console.Write("Enter HPS: ");
  34. hps = int.Parse(Console.ReadLine());
  35. iHps.Add(hps);
  36. Console.WriteLine("Quiz successfully added!");
  37. choice = 0;
  38. }
  39. else if (choice == 2)
  40. {
  41. Console.WriteLine("VIEW QUIZ");
  42. Console.Write("Enter quiz no: ");
  43. quiznum = int.Parse(Console.ReadLine());
  44. if (quiznum <= iScores.Count)
  45. {
  46. Console.WriteLine("Score: " + iScores[quiznum - 1] + "\t" + "HPS: " + iHps[quiznum - 1]);
  47. choice = 0;
  48. }
  49. else
  50. {
  51. Console.WriteLine("Quiz " + quiznum + " doesn't exist!");
  52. choice = 0;
  53. }
  54. }
  55. else if (choice == 3)
  56. {
  57. Console.WriteLine("QUIZ CORRECTIONS");
  58. Console.Write("Enter quiz no: ");
  59. quiznum = int.Parse(Console.ReadLine());
  60. if (quiznum <= iScores.Count)
  61. {
  62. Console.Write("Enter new score: ");
  63. nScore = int.Parse(Console.ReadLine());
  64. iScores[quiznum - 1] = nScore;
  65. Console.WriteLine("Quiz " + quiznum + " successfully updated!");
  66. choice = 0;
  67. }
  68. else
  69. {
  70. Console.WriteLine("Quiz " + quiznum + " doesn't exist!");
  71. choice = 0;
  72. }
  73. }
  74. else if (choice == 4)
  75. {
  76. double scoresum = 0, hpssum = 0;
  77. Console.WriteLine("CLASS STANDING");
  78. for (int i = 1; i < iScores.Count + 1; i++)
  79. {
  80. scoresum += iScores[i - 1];
  81. hpssum += iHps[i - 1];
  82. Console.WriteLine("Quiz " + i + " Score: " + iScores[i - 1] + "\t" + "HPS: " + iHps[i - 1]);
  83. }
  84. Console.WriteLine("Class standing: " + (scoresum / hpssum) * 100);
  85. choice = 0;
  86. }
  87. else if (choice == 5)
  88. {
  89. Console.WriteLine("Exiting the app...");
  90. Console.Write("Press any key to continue . . . ");
  91. }
  92. }
  93. Console.ReadKey();
  94. }
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement