static void Zadatak3() { List <IRentable> lista = new List <IRentable>(); lista.Add(new Book("Power Thought")); lista.Add(new Video("How to be productive!")); RentingConsolePrinter printer = new RentingConsolePrinter(); printer.DisplayItems(lista); printer.PrintTotalPrice(lista); }
static void Zadatak5() { List <IRentable> lista1 = new List <IRentable>(); lista1.Add(new Video("Video")); lista1.Add(new Book("Book")); List <IRentable> lista2 = new List <IRentable>(); foreach (IRentable elem in lista1) { lista2.Add(new DiscountedItem(elem)); } RentingConsolePrinter printer = new RentingConsolePrinter(); printer.DisplayItems(lista2); printer.PrintTotalPrice(lista2); }
static void Zadatak4() { List <IRentable> ime = new List <IRentable>(); ime.Add(new Book("Power Thought")); ime.Add(new Video("How to be productive!")); RentingConsolePrinter printer = new RentingConsolePrinter(); printer.DisplayItems(ime); printer.PrintTotalPrice(ime); IRentable hotbook = new Book("Harry Potter and..."); IRentable hotvideo = new Video("Trending Spanish Song"); ime.Add(new Hotitem(hotbook)); ime.Add(new Hotitem(hotvideo)); printer.DisplayItems(ime); printer.PrintTotalPrice(ime); }
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(); } }