Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int choice, quiznumber;
- double classStanding, sumofscores, sumofHPS;
- choice = 0;
- List<int> scores = new List<int>();
- List<int> HPSs = new List<int>();
- while (choice < 5)
- {
- Console.WriteLine("------------------------");
- Console.WriteLine("1 - Add Quiz");
- Console.WriteLine("2 - View Quiz");
- Console.WriteLine("3 - Corrections");
- Console.WriteLine("4 - View All Quizzes");
- Console.WriteLine("5 - Exit");
- Console.WriteLine("------------------------");
- Console.Write("Enter choice: ");
- choice = int.Parse(Console.ReadLine());
- if (choice == 1)
- {
- Console.WriteLine("NEW QUIZ");
- Console.Write("Enter score: ");
- scores.Add(int.Parse(Console.ReadLine()));
- Console.Write("Enter HPS: ");
- HPSs.Add(int.Parse(Console.ReadLine()));
- Console.WriteLine("Quiz " + scores.Count + " successfully added!");
- }
- if (choice == 2)
- {
- Console.WriteLine("VIEW QUIZ");
- Console.Write("Enter quiz number: ");
- quiznumber = int.Parse(Console.ReadLine());
- if (quiznumber <= scores.Count)
- {
- Console.WriteLine("Score: " + scores[quiznumber - 1] + "\tHPS: " + HPSs[quiznumber - 1]);
- }
- else
- {
- Console.WriteLine("Quiz " + quiznumber + " does not exist.");
- }
- }
- if (choice == 3)
- {
- Console.WriteLine("CORRECTIONS");
- Console.Write("Enter quiz number: ");
- quiznumber = int.Parse(Console.ReadLine());
- Console.Write("Enter new score: ");
- scores[quiznumber - 1] = int.Parse(Console.ReadLine());
- Console.WriteLine("Quiz " + quiznumber + " has been successfully updated!");
- }
- if (choice == 4)
- {
- Console.WriteLine("CLASS STANDING");
- for (int i = 0; i < scores.Count; i++)
- {
- Console.WriteLine("Quiz " + (i + 1) + "\tScore: " + scores[i] + "\tHPS: " + HPSs[i]);
- }
- sumofscores = (scores.Sum() / scores.Count);
- sumofHPS = (HPSs.Sum() / HPSs.Count);
- classStanding = (sumofscores / sumofHPS) * 100;
- Console.WriteLine("Class standing: " + classStanding);
- }
- }
- if (choice == 5)
- {
- Console.WriteLine("Exiting the app...");
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement