Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string[] studentInfo = Console.ReadLine().Split(' ');
            string[] workerInfo  = Console.ReadLine().Split(' ');

            try
            {
                string firstName     = studentInfo[0];
                string lastName      = studentInfo[1];
                string facultyNumber = studentInfo[2];

                string  workeFirstName = workerInfo[0];
                string  workerLastName = workerInfo[1];
                decimal weekSalary     = decimal.Parse(workerInfo[2]);
                double  hoursPerDay    = double.Parse(workerInfo[3]);

                Student student = new Student(firstName, lastName, facultyNumber);

                Worker worker = new Worker(workeFirstName, workerLastName, weekSalary, hoursPerDay);
                Console.WriteLine(student.ToString());
                Console.WriteLine();
                Console.WriteLine(worker.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            string[] studentArgs      = Console.ReadLine().Split();
            string   studentFirstName = studentArgs[0];
            string   studentLastName  = studentArgs[1];
            string   facultyNumber    = studentArgs[2];

            string[] workerArgs      = Console.ReadLine().Split();
            string   workerFirstName = workerArgs[0];
            string   workerLastName  = workerArgs[1];
            double   salaryPerWeek   = double.Parse(workerArgs[2]);
            double   hoursPerDay     = double.Parse(workerArgs[3]);

            StringBuilder output = new StringBuilder();

            try
            {
                Student student = new Student(studentFirstName, studentLastName, facultyNumber);

                output.AppendLine(student.ToString());
                output.AppendLine();

                Worker worker = new Worker(workerFirstName, workerLastName, salaryPerWeek, hoursPerDay);

                output.AppendLine(worker.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Environment.Exit(0);
            }

            Console.WriteLine(output.ToString().Trim());
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            string[] studentInfo = Console.ReadLine().Split();
            string[] workerInfo  = Console.ReadLine().Split();

            string studentFirstName = studentInfo[0];
            string studentLastName  = studentInfo[1];
            string facultyNumber    = studentInfo[2];

            string  workerFirstName = workerInfo[0];
            string  workerLastName  = workerInfo[1];
            decimal weekSalary      = decimal.Parse(workerInfo[2]);
            double  workingHours    = double.Parse(workerInfo[3]);

            try
            {
                Student student = new Student(studentFirstName, studentLastName, facultyNumber);
                Worker  worker  = new Worker(workerFirstName, workerLastName, weekSalary, workingHours);

                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 4
0
        static void Main()
        {
            try
            {
                string[] args                 = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                string   studentFirstName     = args[0];
                string   studentLastName      = args[1];
                string   studentFacultyNumber = args[2];

                args = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                string  workerFirstName    = args[0];
                string  workerLastName     = args[1];
                decimal workerWeekSalary   = decimal.Parse(args[2]);
                decimal workerWorkingHours = decimal.Parse(args[3]);


                var student = new Student(studentFirstName, studentLastName, studentFacultyNumber);
                var worker  = new Worker(workerFirstName, workerLastName, workerWeekSalary, workerWorkingHours);

                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            string[] studentArgs      = Console.ReadLine().Split();
            string   studentFirstName = studentArgs[0];
            string   studentLastName  = studentArgs[1];
            string   facultyNumber    = studentArgs[2];

            string[] workerArgs      = Console.ReadLine().Split();
            string   workerFirstName = workerArgs[0];
            string   workerLastName  = workerArgs[1];
            double   salary          = double.Parse(workerArgs[2]);
            double   workingHours    = double.Parse(workerArgs[3]);

            try
            {
                Student student = new Student(studentFirstName, studentLastName, facultyNumber);
                Worker  worker  = new Worker(workerFirstName, workerLastName, salary, workingHours);

                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.Message);
                Environment.Exit(0);
            }
        }
        public static void Main()
        {
            string[] studentData = Console
                                   .ReadLine()
                                   .Split(" ", StringSplitOptions.RemoveEmptyEntries);

            string studentFirstName     = studentData[0];
            string studentLastName      = studentData[1];
            string studentFacultyNumber = studentData[2];

            Student newStudent;

            try
            {
                newStudent = new Student(
                    studentFirstName,
                    studentLastName,
                    studentFacultyNumber);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }

            string[] workerData = Console
                                  .ReadLine()
                                  .Split(" ", StringSplitOptions.RemoveEmptyEntries);

            string  workerFirstName   = workerData[0];
            string  workerLastName    = workerData[1];
            decimal workerWeekSalary  = decimal.Parse(workerData[2]);
            int     workerHoursPerDay = int.Parse(workerData[3]);

            Worker newWorker;

            try
            {
                newWorker = new Worker(
                    workerFirstName,
                    workerLastName,
                    workerWeekSalary,
                    workerHoursPerDay);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }

            Console.WriteLine(newStudent.ToString());
            Console.WriteLine(newWorker.ToString());
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);

            try
            {
                Student student = new Student(input[0], input[1], input[2]);
                input = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
                Worker worker = new Worker(input[0], input[1], double.Parse(input[2]), double.Parse(input[3]));
                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine($"{ex.Message.ToString()}");
            }
        }
Ejemplo n.º 8
0
        // 86/100
        public static void Main(string[] args)
        {
            var studentInput = Console.ReadLine().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            var workerInput  = Console.ReadLine().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);

            try
            {
                Student student = new Student(studentInput[0], studentInput[1], studentInput[2]);
                Worker  worker  = new Worker(workerInput[0], workerInput[1], decimal.Parse(workerInput[2]), decimal.Parse(workerInput[3]));
                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 9
0
        public static void Main(string[] args)
        {
            string[] studentInfoInput = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            string[] workerInfoInput  = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);

            try
            {
                Student student = new Student(studentInfoInput[0], studentInfoInput[1], studentInfoInput[2]);
                Worker  worker  = new Worker(workerInfoInput[0], workerInfoInput[1], decimal.Parse(workerInfoInput[2]), decimal.Parse(workerInfoInput[3]));
                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.GetBaseException().Message);
            }
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            var studentInfo = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
            var workerInfo  = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray();

            try
            {
                Student student = new Student(studentInfo[0], studentInfo[1], studentInfo[2]);
                Worker  worker  = new Worker(workerInfo[0], workerInfo[1], decimal.Parse(workerInfo[2]), decimal.Parse(workerInfo[3]));
                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            var studentInputInfo = Console.ReadLine().Split(' ');
            var workerInputInfo  = Console.ReadLine().Split(' ');

            try
            {
                Student student = new Student(studentInputInfo[0], studentInputInfo[1], studentInputInfo[2]);
                Worker  worker  = new Worker(workerInputInfo[0], workerInputInfo[1], decimal.Parse(workerInputInfo[2]), int.Parse(workerInputInfo[3]));

                Console.WriteLine(student.ToString());
                Console.WriteLine(worker.ToString());
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.Message);
            }
        }
Ejemplo n.º 12
0
 static void Main(string[] args)
 {
     try
     {
         string[] studentData = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
         Student  student     = new Student(studentData[0], studentData[1], studentData[2]);
         string[] workerData  = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
         Worker   worker      = new Worker(workerData[0], workerData[1], decimal.Parse(workerData[2]), int.Parse(workerData[3]));
         Console.WriteLine(student.ToString());
         Console.WriteLine(worker.ToString());
     }
     catch (ArgumentException ae)
     {
         Console.WriteLine(ae.Message);
         Console.ReadLine();
     }
     Console.ReadLine();
 }
Ejemplo n.º 13
0
        static void Main()
        {
            string[] studentInfo = Console.ReadLine().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            string[] workerInfo  = Console.ReadLine().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            Human    student;
            Human    worker;

            try
            {
                student = new Student(studentInfo[0], studentInfo[1], studentInfo[2]);
                worker  = new Worker(workerInfo[0], workerInfo[1], decimal.Parse(workerInfo[2]), int.Parse(workerInfo[3]));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }
            Console.WriteLine(student.ToString());
            Console.WriteLine(worker.ToString());
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            var studentData = Console.ReadLine().Split();
            var workerData  = Console.ReadLine().Split();

            Student student = null;
            Worker  worker  = null;

            try
            {
                student = new Student(studentData[0], studentData[1], studentData[2]);
                worker  = new Worker(workerData[0], workerData[1], decimal.Parse(workerData[2]), decimal.Parse(workerData[3]));
            }
            catch (ArgumentException ArgEx)
            {
                Console.WriteLine(ArgEx.Message);
                Environment.Exit(0);
            }

            Console.WriteLine(student.ToString());
            Console.WriteLine(worker.ToString());
        }
Ejemplo n.º 15
0
        public static void Main()
        {
            var studentInfo          = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            var studentFirstName     = studentInfo[0];
            var studentLastName      = studentInfo[1];
            var studentFacultyNumber = studentInfo[2];

            var     workerInfo      = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            var     workerFirstName = workerInfo[0];
            var     workerLastName  = workerInfo[1];
            var     weekSalary      = decimal.Parse(workerInfo[2]);
            var     workHours       = decimal.Parse(workerInfo[3]);
            Student student;

            try
            {
                student = new Student(studentFirstName, studentLastName, studentFacultyNumber);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }
            Worker worker;

            try
            {
                worker = new Worker(workerFirstName, workerLastName, weekSalary, workHours);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }

            Console.WriteLine(student.ToString());
            Console.WriteLine(worker.ToString());
        }