Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace LiveDemo
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<Student, string> university = new Dictionary<Student, string>();
- string input = Console.ReadLine();
- while (input != "end")
- {
- string[] inputArr = input.Split();
- string name = inputArr[0];
- string surname = inputArr[1];
- Student student = new Student(name, surname);
- if (university.ContainsKey(student) == false)
- {
- university.Add(student, "Bach ");
- }
- else
- {
- university[student] += "Master";
- }
- input = Console.ReadLine();
- }
- foreach (var stud in university)
- {
- Console.WriteLine($"{stud.Key.Name} {stud.Key.Surname} ---- {stud.Value}");
- }
- Console.WriteLine(Student.Years);
- }
- }
- class Student
- {
- public string Name { get; set; }
- public string Surname { get; set; }
- public Student(string name)
- {
- this.Name = name;
- }
- public Student(string name, string surname)
- {
- this.Name = name;
- this.Surname = surname;
- }
- public static int Years
- {
- get
- {
- return 20;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement