Esempio n. 1
0
        public static void Main()
        {
            string[] tokensStudent = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            StringBuilder result = new StringBuilder();

            try
            {
                var student = new Student(tokensStudent[0], tokensStudent[1], tokensStudent[2]);
                result.AppendLine(student.ToString());
                result.AppendLine();
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);

                Environment.Exit(0);
            }

            string[] tokensWorker = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            try
            {
                var worker = new Worker(tokensWorker[0], tokensWorker[1], double.Parse(tokensWorker[2]), double.Parse(tokensWorker[3]));
                result.AppendLine(worker.ToString());
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);

                Environment.Exit(0);
            }

            Console.WriteLine(result.ToString());
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string[] studentInput = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
            string[] workerInput  = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);

            try
            {
                string  firstNameS  = studentInput[0];
                string  lastNameS   = studentInput[1];
                string  facultyNumS = studentInput[2];
                Student student     = new Student(firstNameS, lastNameS, facultyNumS);

                string  firstNameW  = workerInput[0];
                string  lastNameW   = workerInput[1];
                decimal weekSalary  = decimal.Parse(workerInput[2]);
                decimal hoursPerDay = decimal.Parse(workerInput[3]);
                Worker  worker      = new Worker(firstNameW, lastNameW, weekSalary, hoursPerDay);

                Console.WriteLine(student.ToString());
                Console.WriteLine();
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 3
0
        private static void Main()
        {
            try
            {
                string[] firstLineItems   = Console.ReadLine().Split();
                string   firstNameStudent = firstLineItems[0];
                string   lastNameStudent  = firstLineItems[1];
                string   faculty          = firstLineItems[2];

                string[] secondLineItems = Console.ReadLine().Split();
                string   firstNameWorker = secondLineItems[0];
                string   lastNameWorker  = secondLineItems[1];
                double   weeklySalary    = double.Parse(secondLineItems[2]);
                double   workingHours    = double.Parse(secondLineItems[3]);

                Student student = new Student(firstNameStudent, lastNameStudent, faculty);

                Worker worker = new Worker(firstNameWorker, lastNameWorker, weeklySalary, workingHours);

                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
Esempio n. 4
0
        public static void Main(string[] args)
        {
            //// Student
            var line = Console.ReadLine()
                       .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                       .ToArray();

            var     firstName     = line[0];
            var     lastName      = line[1];
            var     facultyNumber = line[2];
            Student student;

            try
            {
                student = new Student(firstName, lastName, facultyNumber);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }
            //// End Student

            //// Worker
            line = Console.ReadLine()
                   .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                   .ToArray();

            firstName = line[0];
            lastName  = line[1];
            var    weekSalary  = decimal.Parse(line[2]);
            var    hoursPerDay = int.Parse(line[3]);
            Worker worker;

            try
            {
                worker = new Worker(firstName, lastName, weekSalary, hoursPerDay);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }
            //// End Worker

            Console.WriteLine(student.ToString());
            Console.WriteLine(worker.ToString());
        }
Esempio n. 5
0
 static void Main(string[] args)
 {
     try
     {
         string[] studentLine = Console.ReadLine().Split(' ');
         Student  student     = new Student(studentLine[0], studentLine[1], studentLine[2]);
         string[] workerLine  = Console.ReadLine().Split(' ');
         Worker   worker      = new Worker(workerLine[0], workerLine[1],
                                           decimal.Parse(workerLine[2]), int.Parse(workerLine[3]));
         Console.WriteLine(student.ToString());
         Console.WriteLine(worker.ToString());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Esempio n. 6
0
 static void Main(string[] args)
 {
     try
     {
         var     studentTokens = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
         Student student       = new Student(studentTokens[0], studentTokens[1], studentTokens[2]);
         var     workerTokens  = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
         Worker  worker        = new Worker(workerTokens[0], workerTokens[1], decimal.Parse(workerTokens[2]), decimal.Parse(workerTokens[3]));
         Console.WriteLine(student.ToString());
         Console.WriteLine();
         Console.WriteLine(worker.ToString());
     }
     catch (ArgumentException ae)
     {
         Console.WriteLine(ae.Message);
     }
 }
Esempio n. 7
0
        public static void Main()
        {
            var studentInfo = Console.ReadLine().Split();
            var workerInfo  = Console.ReadLine().Split();

            try
            {
                var student = new Student(studentInfo[0], studentInfo[1], studentInfo[2]);
                var worker  = new Worker(workerInfo[0], workerInfo[1], decimal.Parse(workerInfo[2]), double.Parse(workerInfo[3]));
                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            string[] tokens        = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string   firstName     = tokens[0];
            string   lastName      = tokens[1];
            string   facultyNumber = tokens[2];
            Student  student;

            try
            {
                student = new Student(firstName, lastName, facultyNumber);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }

            input     = Console.ReadLine();
            tokens    = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            firstName = tokens[0];
            lastName  = tokens[1];

            decimal weekSalary  = decimal.Parse(tokens[2]);
            decimal hoursPerDay = decimal.Parse(tokens[3]);

            Worker worker;

            try
            {
                worker = new Worker(firstName, lastName, weekSalary, hoursPerDay);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }

            Console.WriteLine(student.ToString());
            Console.WriteLine();
            Console.WriteLine(worker.ToString());
            Console.WriteLine();
        }
Esempio n. 9
0
        public static void Main()
        {
            try
            {
                string[] studentValues = Console.ReadLine().Split().ToArray();
                string[] workerValues  = Console.ReadLine().Split().ToArray();
                Student  student       = new Student(studentValues[0], studentValues[1], studentValues[2]);
                Worker   worker        = new Worker(workerValues[0], workerValues[1], decimal.Parse(workerValues[2]), decimal.Parse(workerValues[3]));

                Console.WriteLine(student.ToString());
                Console.WriteLine();
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.Message);
            }
        }
Esempio n. 10
0
        public static void Main()
        {
            try
            {
                var inputStudent = Console.ReadLine().Split(new [] { " " }, StringSplitOptions.RemoveEmptyEntries);
                var inputWorker  = Console.ReadLine().Split(new [] { " " }, StringSplitOptions.RemoveEmptyEntries);

                var student = new Student(inputStudent[0], inputStudent[1], inputStudent[2]);

                var worker = new Worker(inputWorker[0], inputWorker[1], decimal.Parse(inputWorker[2]), decimal.Parse(inputWorker[3]));

                Console.WriteLine(student.ToString());
                Console.WriteLine();
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            var strudentInputString = Console.ReadLine()
                                      .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);


            var workerInputString = Console.ReadLine()
                                    .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);


            try
            {
                var student = new Student(strudentInputString[0], strudentInputString[1], strudentInputString[2]);
                var worker  = new Worker(workerInputString[0], workerInputString[1], decimal.Parse(workerInputString[2]), decimal.Parse(workerInputString[3]));

                Console.WriteLine(student.ToString());
                Console.WriteLine();
                Console.WriteLine(worker.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Esempio n. 12
0
 public static void PrintData(Student student, Worker worker)
 {
     Console.WriteLine(student.ToString());
     Console.WriteLine(worker.ToString());
 }