Example #1
0
        static void Zadatak6()
        {
            EmailValidator    mailValidator = new EmailValidator();
            PasswordValidator pwValidator   = new PasswordValidator(10);

            string testMail1 = "mihael@ferithr";
            string testMail2 = "mihaelferit.hr";
            string testMail3 = "*****@*****.**";

            if (mailValidator.IsValidAddress(testMail1))
            {
                Console.WriteLine(testMail1 + " is valid");
            }
            if (mailValidator.IsValidAddress(testMail2))
            {
                Console.WriteLine(testMail2 + " is valid");
            }
            if (mailValidator.IsValidAddress(testMail3))
            {
                Console.WriteLine(testMail3 + " is valid");
            }

            string testPw1 = "lozinka123";
            string testPw2 = "lozinka123";

            if (pwValidator.IsValidPassword(testPw1))
            {
                Console.WriteLine(testPw1 + " is valid");
            }
            if (pwValidator.IsValidPassword(testPw2))
            {
                Console.WriteLine(testPw2 + " is valid");
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Dataset          csvFile  = new Dataset("adapterinput.txt");
            Analyzer3rdParty analyzer = new Analyzer3rdParty();
            Adapter          adapter  = new Adapter(analyzer);

            Console.WriteLine("Prosjek redaka: ");
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine(adapter.CalculateAveragePerRow(csvFile)[i]);
            }
            Console.WriteLine("Prosjek stupaca: ");
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine(adapter.CalculateAveragePerColumn(csvFile)[i]);
            }

            List <IRentable> rentList = new List <IRentable>();
            Video            video    = new Video("Video dokumentarac");
            Book             book     = new Book("Knjiga fantazija");

            rentList.Add(video);
            rentList.Add(book);

            RentingConsolePrinter printer = new RentingConsolePrinter();

            printer.DisplayItems(rentList);
            printer.PrintTotalPrice(rentList);

            HotItem      hitVid       = new HotItem(new Video("Hit video"));
            DiscountItem discountBook = new DiscountItem(new Book("Discount knjiga"));

            rentList.Add(hitVid);
            rentList.Add(discountBook);
            printer.DisplayItems(rentList);
            printer.PrintTotalPrice(rentList);

            EmailValidator    emailValidator    = new EmailValidator(12);
            PasswordValidator passwordValidator = new PasswordValidator(6);
            String            passwordToCheck   = new string("sIFra23sd");
            String            passwordToCheck2  = new string("si3sd");
            String            emailToCheck      = new string("*****@*****.**");
            String            emailToCheck2     = new string("emailnezadovoljava@[email protected]");

            Console.WriteLine("\n\nProvjera: ");
            Console.WriteLine("sIFra23sd: " + passwordValidator.IsValidPassword(passwordToCheck));
            Console.WriteLine("si3sd: " + passwordValidator.IsValidPassword(passwordToCheck2));
            Console.WriteLine("[email protected]: " + emailValidator.IsValidAddress(emailToCheck));
            Console.WriteLine("emailnezadovoljava@[email protected]: " + emailValidator.IsValidAddress(emailToCheck2));
        }
Example #3
0
        static void Main(string[] args)
        {
            Dataset csvFile = new Dataset("CSV.txt");

            Analyzer3rdParty analyzer = new Analyzer3rdParty();
            Adapter          adapter  = new Adapter(analyzer);

            Console.WriteLine("Prosjek redaka:");
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine(adapter.CalculateAveragePerRow(csvFile)[i]);
            }
            Console.WriteLine("Prosjek stupaca:");
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine(adapter.CalculateAveragePerColumn(csvFile)[i]);
            }

            List <IRentable> rentList = new List <IRentable>();
            Video            video    = new Video("Video X");
            Book             book     = new Book("Knjiga X");

            rentList.Add(video);
            rentList.Add(book);

            RentingConsolePrinter printer = new RentingConsolePrinter();

            printer.DisplayItems(rentList);
            printer.PrintTotalPrice(rentList);

            HotItem      hitVid       = new HotItem(new Video("Video hit"));
            DiscountItem discountBook = new DiscountItem(new Book("Knjiga - discount"));

            rentList.Add(hitVid);
            rentList.Add(discountBook);
            printer.DisplayItems(rentList);
            printer.PrintTotalPrice(rentList);

            EmailValidator    emailValidator    = new EmailValidator(12);
            PasswordValidator passwordValidator = new PasswordValidator(6);
            String            passwordToCheck   = new string("MoZe123");
            String            passwordToCheck2  = new string("nemoze123");
            String            emailToCheck      = new string("*****@*****.**");
            String            emailToCheck2     = new string("nevalja@[email protected]");

            Console.WriteLine("MoZe123: " + passwordValidator.IsValidPassword(passwordToCheck));
            Console.WriteLine("nemoze123: " + passwordValidator.IsValidPassword(passwordToCheck2));
            Console.WriteLine("[email protected]: " + emailValidator.IsValidAddress(emailToCheck));
            Console.WriteLine("nevalja@[email protected]: " + emailValidator.IsValidAddress(emailToCheck2));
        }
Example #4
0
        static void Main(string[] args)
        {
            //2. Zadatak
            Console.WriteLine("Ovo je 2. zadatak.");
            Dataset          newDataset  = new Dataset("csv.txt");
            Analyzer3rdParty newAnalyzer = new Analyzer3rdParty();
            Adapter          newAdapter  = new Adapter(newAnalyzer);

            double[] averageRows = newAdapter.CalculateAveragePerRow(newDataset);
            Console.WriteLine("Prosjek redaka:");
            for (int i = 0; i < averageRows.Length; i++)
            {
                Console.WriteLine(averageRows[i]);
            }
            double[] averageColumns = newAdapter.CalculateAveragePerColumn(newDataset);
            Console.WriteLine("Prosjek stupaca:");
            for (int i = 0; i < averageColumns.Length; i++)
            {
                Console.WriteLine(averageColumns[i]);
            }

            //3. Zadatak
            Console.WriteLine("Ovo je 3. zadatak.");
            List <IRentable> BooksAndMovies = new List <IRentable>();
            Book             bookExample    = new Book("Ana Karenjina");
            Video            videoExample   = new Video("Rat i mir");

            BooksAndMovies.Add(bookExample);
            BooksAndMovies.Add(videoExample);
            RentingConsolePrinter printerExample = new RentingConsolePrinter();

            printerExample.PrintTotalPrice(BooksAndMovies);
            printerExample.DisplayItems(BooksAndMovies);

            //4. Zadatak
            Console.WriteLine("Ovo je 4. zadatak.");
            HotItem newestBook  = new HotItem(new Book("Stranac"));
            HotItem newestVideo = new HotItem(new Video("Parazit"));

            BooksAndMovies.Add(newestBook);
            BooksAndMovies.Add(newestVideo);
            printerExample.PrintTotalPrice(BooksAndMovies);
            printerExample.DisplayItems(BooksAndMovies);

            /* Cijena liste sa samo prva dva elementa bila je 13.98. Dodavanje jos
             * elementa cijena bi trebala biti 27.96. Međutim, dodani asortiman
             * pripada HitItem-ima pa je cijena veća -> 31.94. Također uz naslove
             * stoji naznaka da artikl pripada Trendingu.*/

            //5. Zadatak
            Console.WriteLine("Ovo je 5. zadatak.");
            List <IRentable> flashSale = new List <IRentable>();

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


            //6. zadatak
            Console.WriteLine("Ovo je 6. zadatak.");
            string            myMail        = "*****@*****.**";
            string            myPass        = "******";
            EmailValidator    mailValidator = new EmailValidator();
            PasswordValidator passValidator = new PasswordValidator(8);

            if (mailValidator.IsValidAddress(myMail))
            {
                Console.WriteLine("Vasa eMail adresa" + myMail + "je ispravna.");
            }
            else
            {
                Console.WriteLine("Vasa eMail adresa " + myMail + " nije ispravna.");
            }
            if (passValidator.IsValidPassword(myPass))
            {
                Console.WriteLine("Vasa lozinka je ispravna.");
            }
            else
            {
                Console.WriteLine("Vasa lozinka nije ispravna.");
            }

            //7. Zadatak
            Console.WriteLine("Ovo je 7. zadatak.");
            //UserEntry.ReadUserFromConsole();
            RegistrationValidator finalValidator = new RegistrationValidator();
            UserEntry             entry          = UserEntry.ReadUserFromConsole();

            while (!(finalValidator.IsUserEntryValid(entry)))
            {
                entry = UserEntry.ReadUserFromConsole();
            }
        }