Advertisement
Kenkaster001

CODE HOA3

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