Example #1
0
        public static void goToSleepAndMafiaChooseVictim(out string playerToMurder, IPrintable round)
        {
            Console.WriteLine("Announce for the town to go to sleep. Then tell Mafia to awake and choose player to murder.");

            round.print();

            Console.WriteLine("Type the name of the person that the mafia murdered:");
            playerToMurder = Console.ReadLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            IPrintable printer = PrinterCreator.create(PrinterType.CONSOLE);

            printer.print("Input count of elements in vector:");
            int n = UserInput.inputInt();

            double[] doubleArray = new double[n];

            for (int i = 0; i < n; i++)
            {
                printer.print("Input element №" + i);
                doubleArray[i] = UserInput.inputDouble();
            }

            Vector vector        = new Vector(doubleArray);
            double sumOfNegative = Calculator.sumOfNegativeElem(vector);
            double prodOfElem    = Calculator.prodOfElemBetweenMinAndMax(vector);
            int    indexMax      = Calculator.indexOfMaxElem(vector);
            int    indexMin      = Calculator.indexOfMinElem(vector);

            printer.print("sum of negative elements = " + sumOfNegative);
            printer.print("product of elements between min and max = " + prodOfElem);
            printer.print("max index = " + indexMax);
            printer.print("min index = " + indexMin);

            Console.ReadKey();
        }
Example #3
0
        static void Main(string[] args)
        {
            IPrintable printer = PrinterCreator.create(PrinterType.CONSOLE);

            printer.print("Input count of elements in vector:");
            int n = UserInput.inputInt();

            int[] intArray = new int[n];

            for (int i = 0; i < n; i++)
            {
                printer.print("Input element №" + i);
                intArray[i] = UserInput.inputInt();
            }

            Vector vector     = new Vector(intArray);
            int    sumOfElem  = Calculator.sumOfElemBetweenFirstAndLastZero(vector);
            int    prodOfElem = Calculator.prodOfEvenElem(vector);
            int    firstZero  = Calculator.indexOfFirstZero(vector);
            int    lastZero   = Calculator.indexOfLastZero(vector);

            printer.print("product of even elements = " + prodOfElem);
            printer.print("sum of elements between first and last zero = " + sumOfElem);
            printer.print("index of first zero = " + firstZero);
            printer.print("index of last zero = " + lastZero);

            Console.ReadKey();
        }
Example #4
0
        static void Main(string[] args)
        {
            IPrintable printer = PrinterCreator.create(PrinterType.CONSOLE);

            Student student1 = new Student("Roma", 7.5);
            Student student2 = new Student("Leha", 8);
            Student student3 = new Student("Ilya", 6.9);

            Student[] students = new Student[] { student1, student2 };

            Brigade brigade = new Brigade("no name", students);

            printer.print(brigade);

            brigade.add(student3);
            printer.print(brigade);

            brigade.remove(student2);
            printer.print(brigade);

            double averageMark = Calculator.calcAverageMark(brigade);

            printer.print(averageMark);

            Student studentWithMaxMark = Searcher.findStudentWithMaxMark(brigade);

            printer.print(studentWithMaxMark);

            Student studentWithMinMark = Searcher.findStudentWithMinMark(brigade);

            printer.print(studentWithMinMark);

            brigade.replaceByIndex(student2, 0);
            printer.print(brigade);

            bool atBrigade = brigade.isAtBrigade(student1);

            printer.print(atBrigade);

            Console.ReadKey();
        }
Example #5
0
 public static void Print(IPrintable shape)
 {
     Console.WriteLine(shape.print());
 }
Example #6
0
 public void printMessage()
 {
     msg1.print(helloMessage);
 }
Example #7
0
 public virtual void print(string format, params object[] list)
 {
     _writer.print(format, list);
 }
 public void executeStrategy(List <MovieRentalDatabase.Row> rentals)
 {
     context.print(rentals);
 }