Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace HOA3_12Eva03AmadorJohnMichael
- {
- class Program
- {
- static void Main(string[] args)
- {
- int choice = 0, score, hps, quiznum, nScore;
- List<int> iScores = new List<int>();
- List<int> iHps = new List<int>();
- while (choice == 0)
- {
- 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: ");
- score = int.Parse(Console.ReadLine());
- iScores.Add(score);
- Console.Write("Enter HPS: ");
- hps = int.Parse(Console.ReadLine());
- iHps.Add(hps);
- Console.WriteLine("Quiz successfully added!");
- choice = 0;
- }
- else if (choice == 2)
- {
- Console.WriteLine("VIEW QUIZ");
- Console.Write("Enter quiz no: ");
- quiznum = int.Parse(Console.ReadLine());
- if (quiznum <= iScores.Count)
- {
- Console.WriteLine("Score: " + iScores[quiznum - 1] + "\t" + "HPS: " + iHps[quiznum - 1]);
- choice = 0;
- }
- else
- {
- Console.WriteLine("Quiz " + quiznum + " doesn't exist!");
- choice = 0;
- }
- }
- else if (choice == 3)
- {
- Console.WriteLine("QUIZ CORRECTIONS");
- Console.Write("Enter quiz no: ");
- quiznum = int.Parse(Console.ReadLine());
- if (quiznum <= iScores.Count)
- {
- Console.Write("Enter new score: ");
- nScore = int.Parse(Console.ReadLine());
- iScores[quiznum - 1] = nScore;
- Console.WriteLine("Quiz " + quiznum + " successfully updated!");
- choice = 0;
- }
- else
- {
- Console.WriteLine("Quiz " + quiznum + " doesn't exist!");
- choice = 0;
- }
- }
- else if (choice == 4)
- {
- double scoresum = 0, hpssum = 0;
- Console.WriteLine("CLASS STANDING");
- for (int i = 1; i < iScores.Count + 1; i++)
- {
- scoresum += iScores[i - 1];
- hpssum += iHps[i - 1];
- Console.WriteLine("Quiz " + i + " Score: " + iScores[i - 1] + "\t" + "HPS: " + iHps[i - 1]);
- }
- Console.WriteLine("Class standing: " + (scoresum / hpssum) * 100);
- choice = 0;
- }
- else if (choice == 5)
- {
- Console.WriteLine("Exiting the app...");
- Console.Write("Press any key to continue . . . ");
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement