コード例 #1
0
ファイル: Program.cs プロジェクト: Luka1495/LV4
        static void Main(string[] args)
        {
            Dataset          data    = new Dataset("Luka Vukadin.csv");
            Analyzer3rdParty analyze = new Analyzer3rdParty();
            Adapter          adapter = new Adapter(analyze);

            Console.WriteLine(adapter.CalculateAveragePerColumn(data));

            double[] res = adapter.CalculateAveragePerColumn(data);

            foreach (double r in res)
            {
                Console.WriteLine(r);
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Dataset testExample = new Dataset("TestFile.txt");

            double[]         rowsAvg, columnsAvg;
            Analyzer3rdParty matrixAnalyzer = new Analyzer3rdParty();
            Adapter          list2DToMatrix = new Adapter(matrixAnalyzer);

            rowsAvg    = list2DToMatrix.CalculateAveragePerRow(testExample);
            columnsAvg = list2DToMatrix.CalculateAveragePerColumn(testExample);
            for (int i = 0; i < columnsAvg.Length; i++)
            {
                Console.WriteLine("average result in " + (i + 1) + ". column:" + columnsAvg[i]);
            }
            for (int i = 0; i < rowsAvg.Length; i++)
            {
                Console.WriteLine("average result in " + (i + 1) + ". row:" + rowsAvg[i]);
            }
            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Dataset          data     = new Dataset("file.csv");
            Analyzer3rdParty analyzer = new Analyzer3rdParty();
            Adapter          adapter  = new Adapter(analyzer);

            double[] colresult = adapter.CalculateAveragePerColumn(data);
            Console.WriteLine("Prosjek po stupcima: ");
            foreach (double colres in colresult)
            {
                Console.WriteLine(colres);
            }

            Console.WriteLine("Prosjek po redovima: ");
            double[] rowresult = adapter.CalculateAveragePerRow(data);
            foreach (double rowres in rowresult)
            {
                Console.WriteLine(rowres);
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: Ivan9666/RPOON
        static void Main()
        {
            Dataset          data     = new Dataset(System.AppDomain.CurrentDomain.BaseDirectory + "dataset.csv");
            Analyzer3rdParty analyzer = new Analyzer3rdParty();
            Adapter          adapter  = new Adapter(analyzer);

            double[] rowAverage    = adapter.CalculateAveragePerRow(data);
            double[] columnAverage = adapter.CalculateAveragePerColumn(data);

            System.Console.WriteLine("Column Averages:");
            foreach (double n in columnAverage)
            {
                System.Console.Write(n + " ");
            }

            System.Console.WriteLine("\n----------------------");

            System.Console.WriteLine("Row Averages:");
            foreach (double n in rowAverage)
            {
                System.Console.WriteLine(n);
            }
        }
コード例 #5
0
        static void Main(string[] args)
        {
            Dataset          dataset  = new Dataset("zadatak.txt");
            Analyzer3rdParty analyzer = new Analyzer3rdParty();
            Adapter          adapter  = new Adapter(analyzer);

            double[] rowAverages    = adapter.CalculateAveragePerRow(dataset);
            double[] columnAverages = adapter.CalculateAveragePerColumn(dataset);

            Console.WriteLine("Row averages:");
            foreach (double number in rowAverages)
            {
                Console.WriteLine(number);
            }

            Console.WriteLine("Column averages:");
            foreach (double number in columnAverages)
            {
                Console.WriteLine(number);
            }

            List <IRentable> rentables = new List <IRentable>();

            rentables.Add(new Video("Video 1"));
            rentables.Add(new Book("Book 1"));

            RentingConsolePrinter printer = new RentingConsolePrinter();

            printer.DisplayItems(rentables);
            printer.PrintTotalPrice(rentables);

            rentables.Add(new HotItem(new Video("Trending video")));
            rentables.Add(new HotItem(new Book("Trending book")));

            printer.DisplayItems(rentables);
            printer.PrintTotalPrice(rentables);
        }
コード例 #6
0
ファイル: Adapter.cs プロジェクト: MihaelaUdovicic/LV4
 public Adapter(Analyzer3rdParty service)
 {
     this.analyticsService = service;
 }
コード例 #7
0
        static void Main(string[] args)
        {
            Dataset          newDataset  = new Dataset("csv.txt");
            Analyzer3rdParty newAnalyzer = new Analyzer3rdParty();
            Adapter          newAdapter  = new Adapter(newAnalyzer);

            double[] averageRows    = newAdapter.CalculateAveragePerRow(newDataset);
            double[] averageColumns = newAdapter.CalculateAveragePerColumn(newDataset);

            for (int i = 0; i < averageRows.Length; i++)
            {
                Console.WriteLine(averageRows[i]);
            }

            for (int i = 0; i < averageColumns.Length; i++)
            {
                Console.WriteLine(averageColumns[i]);
            }

            List <IRentable> HitList = new List <IRentable>();
            Video            video   = new Video("Game of Thrones");
            Book             book    = new Book("Osnove Elektrotenike 1");

            HitList.Add(video);
            HitList.Add(book);
            RentingConsolePrinter printer = new RentingConsolePrinter();

            printer.PrintTotalPrice(HitList);
            printer.DisplayItems(HitList);

            HotItem hitVideo = new HotItem(new Video("Breaking Bad"));
            HotItem hitBook  = new HotItem(new Book("Osnove elektrotehnike 2"));

            HitList.Add(hitVideo);
            HitList.Add(hitBook);
            printer.PrintTotalPrice(HitList);
            printer.DisplayItems(HitList);

            List <IRentable> flashSale = new List <IRentable>();

            for (int i = 0; i < 4; i++)
            {
                flashSale.Add(new DiscountedItem(HitList[i], 20));
            }
            printer.PrintTotalPrice(flashSale);
            printer.DisplayItems(flashSale);

            string            mail              = "*****@*****.**";
            string            password          = "******";
            EmailValidator    emailValidator    = new EmailValidator();
            PasswordValidator passwordValidator = new PasswordValidator(10);

            if (emailValidator.IsValidAddress(mail))
            {
                Console.WriteLine("E-mail address " + mail + " is correct.");
            }

            else
            {
                Console.WriteLine("E-mail address " + mail + " is NOT correct.");
            }
            if (passwordValidator.IsValidPassword(password))
            {
                Console.WriteLine("Password is correct.");
            }
            else
            {
                Console.WriteLine("Password is NOT correct.");
            }
        }