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;
- List<double> scores = new List<double>();
- List<double> hps = new List<double>();
- 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: ");
- scores.Add(double.Parse(Console.ReadLine()));
- Console.Write("Enter HPS: ");
- hps.Add(double.Parse(Console.ReadLine()));
- Console.WriteLine("Quiz successfully added!");
- choice = 0;
- }
- else if (choice == 2)
- {
- int quiznum;
- Console.WriteLine("VIEW QUIZ");
- Console.Write("Enter quiz no: ");
- quiznum = int.Parse(Console.ReadLine());
- if (quiznum > scores.Count)
- {
- Console.WriteLine("Quiz " + quiznum + " doesn't exist!");
- choice = 0;
- }
- else if (quiznum <= scores.Count)
- {
- Console.WriteLine("Score: " + scores[quiznum - 1] + "\t" + "HPS: " + hps[quiznum - 1]);
- choice = 0;
- }
- }
- else if (choice == 3)
- {
- int quiznum, newscore;
- Console.WriteLine("QUIZ CORRECTIONS");
- Console.Write("Enter quiz no: ");
- quiznum = int.Parse(Console.ReadLine());
- if (quiznum > scores.Count)
- {
- Console.WriteLine("Quiz " + quiznum + " doesn't exist!");
- choice = 0;
- }
- else
- {
- Console.WriteLine("Enter new score: ");
- newscore = int.Parse(Console.ReadLine());
- scores[quiznum - 1] = newscore;
- Console.WriteLine("Quiz " + quiznum + " successfully updated!");
- choice = 0;
- }
- }
- else if (choice == 4)
- {
- double sumhps = 0, sumscores = 0, output;
- Console.WriteLine("CLASS STANDING");
- for (int i = 0; i < scores.Count; i++)
- {
- Console.WriteLine("Quiz " + (i + 1) + "\t Score: " + scores[i] + "\t" + "HPS: " + hps[i]);
- sumscores += scores[i];
- }
- for (int i = 0; i < hps.Count; i++)
- {
- sumhps += hps[i];
- }
- output = (sumscores / sumhps);
- Console.WriteLine("Class standing: " + (output * 100));
- choice = 0;
- }
- else if (choice == 5)
- {
- Console.WriteLine("Exiting the app...");
- Console.WriteLine("Press any key to continue. . .");
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement