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); }
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."); } }
static void Main(string[] args) { //1. i 2. zad //Console.WriteLine("Hello World"); //Dataset dataset = new Dataset(@"C:/Korisnici/User/source/repos/LV4/LV4/dat.txt"); //Analyzer3rdParty analyzer = new Analyzer3rdParty(); //Adapter adapter = new Adapter(analyzer); //double[] redovi = new double[3]; //double[] stupci = new double[4]; //redovi = adapter.CalculateAveragePerRow(dataset); //stupci = adapter.CalculateAveragePerColumn(dataset); //for (int i = 0; i < redovi.Length; i++) //{ // Console.WriteLine(redovi[i]+" "); //} //Console.WriteLine("\n"); //for (int i = 0; i < stupci.Length; i++) //{ // Console.WriteLine(stupci[i]+" "); //} ////3. i 4. zad //List<IRentable> lista = new List<IRentable>(); Knjiga book1 = new Knjiga("TriPrascica"); Video film1 = new Video("StarWars"); ////lista.Add(book1); ////lista.Add(film1); //HotItem hot = new HotItem(book1); //HotItem hot1 = new HotItem(film1); Knjiga book2 = new Knjiga("Crvenkapica"); Video film2 = new Video("JamesBond"); //HotItem hot2 = new HotItem(book2); //HotItem hot3 = new HotItem(film2); //lista.Add(hot); //lista.Add(hot1); //lista.Add(hot2); //lista.Add(hot3); //5.zad List <IRentable> flashSale = new List <IRentable>(); DiscountedItem item = new DiscountedItem(book1); DiscountedItem item1 = new DiscountedItem(film1); DiscountedItem item2 = new DiscountedItem(book2); DiscountedItem item3 = new DiscountedItem(film2); flashSale.Add(item); flashSale.Add(item1); flashSale.Add(item2); flashSale.Add(item3); RentingConsolePrinter printer = new RentingConsolePrinter(); //printer.PrintTotalPrice(lista); //printer.DisplayItems(lista); //5.zad printer.PrintTotalPrice(flashSale); printer.DisplayItems(flashSale); //razlika je u tome sto se ukupna cijena poveca za 1.99 i ispisuje se trending ////provjera 6 zad //string mail= "*****@*****.**"; //EmailValidator evs = new EmailValidator(); //evs.IsValidAddress(mail); //Console.WriteLine("Mail je valjan: " + evs.IsValidAddress(mail)); //7 zad Validator val = new Validator(); while (true) { UserEntry user = new UserEntry.ReadUserFromConsole(); if (val.IsUserEntryValid(user) == true) { Console.WriteLine("Valjan korisnik!"); break; } else { continue; } } }