static void Main(string[] args) { Console.Write("Introduce your name: "); string firstName = Console.ReadLine(); Console.Write("Introduce your last name: "); string lastName = Console.ReadLine(); Console.Write("ID: "); int id = Convert.ToInt32(Console.ReadLine()); Console.Write("Num. Scores: "); int[] scores = new int[Convert.ToInt32(Console.ReadLine())]; for (int i = 0; i < scores.Length; i++) { Console.Write($"Score[{i+1}]: "); scores[i] = Convert.ToInt32(Console.ReadLine()); } Student student = new Student(firstName, lastName, id, scores); Console.WriteLine(); student.PrintPerson(); Console.WriteLine($"Grade: {student.Calculate()}\n"); }
static void Main(string[] args) { //You are given two classes, Person and Student, where Person is the base class and Student is the derived class. //FOr ex his student had scores to average: and.The student's average grade is . An average grade of corresponds to the letter grade , so our calculate() method should return the character'O' try { string[] inputs = Console.ReadLine().Split(); string firstName = inputs[0]; string lastName = inputs[1]; int id = Convert.ToInt32(inputs[2]); int numScores = Convert.ToInt32(Console.ReadLine()); inputs = Console.ReadLine().Split(); int[] scores = new int[numScores]; for (int i = 0; i < numScores; i++) { scores[i] = Convert.ToInt32(inputs[i]); } Student s = new Student(firstName, lastName, id, scores); s.printPerson(); Console.WriteLine("Grade: " + s.Calculate() + "\n"); } catch (Exception ex) { Console.WriteLine(ex); } }
static void Main(string[] args) { string[] inputs = Console.ReadLine().Split(); string firstName = inputs[0]; string lastName = inputs[1]; int id = Convert.ToInt32(inputs[2]); int numScores = Convert.ToInt32(Console.ReadLine()); inputs = Console.ReadLine().Split(); int[] scores = new int[numScores]; for (int i = 0; i < numScores; i++) { scores[i] = Convert.ToInt32(inputs[i]); } Student s = new Student(firstName, lastName, id, scores); s.printPerson(); Console.WriteLine("Grade: " + s.Calculate() + "\n"); }