static void Main(string[] args) { Notebook notebook = new Notebook(); notebook.AddNote(new Note("Note1", "Text1")); notebook.AddNote(new Note("Note2", "Text2")); notebook.AddNote(new Note("Note3", "Text3")); IAbstractIterator iterator = notebook.GetIterator(); for (Note note = iterator.First(); !iterator.IsDone; note = iterator.Next()) { note.Show(); } Box box = new Box(); box.AddProduct(new Product("Product1", 10.99)); box.AddProduct(new Product("Product2", 5)); box.AddProduct(new Product("Product3", 12.8)); IAbstractIteratorBox iteratorbox = box.GetIterator(); for (Product product = iteratorbox.First(); !iteratorbox.IsDone; product = iteratorbox.Next()) { Console.WriteLine(product.ToString()); } }
static void Main(string[] args) { //Zad 1. Notebook notebook = new Notebook(); notebook.AddNote(new Note("Taxi", "5 dollars")); notebook.AddNote(new Note("Forrest Gump", "Run Forrest run!")); notebook.AddNote(new Note("Lord of the rings", "What about second breakfast?")); IAbstractIterator notebookIterator = notebook.GetIterator(); notebookIterator.First().Show(); while (notebookIterator.Next() != null) { notebookIterator.Current.Show(); } //Zad 2. Box box = new Box(); box.AddProduct(new Product("Keyboard", 199.99)); box.AddProduct(new Product("Mouse", 249.99)); box.AddProduct(new Product("Headset", 299.99)); IBoxIterator boxIterator = box.GetIterator(); Console.WriteLine(boxIterator.First().ToString()); while (boxIterator.Next() != null) { Console.WriteLine(boxIterator.Current.ToString()); } }
public void Display() { IAbstractIterator iterator = CreateIterator(); Console.WriteLine("Prolazim kroz listu emisija:"); for (IRasporedEmisija item = iterator.First(); !iterator.IsDone; item = iterator.Next()) { Console.WriteLine(((EmisijaLeaf)item).Emisija.Emisija.naziv); } }
public void Display() { IAbstractIterator iterator = CreateIterator(); Console.WriteLine("Prolazim kroz listu dana:"); for (IRasporedEmisija item = iterator.First(); !iterator.IsDone; item = iterator.Next()) { Console.WriteLine(((DanComposite)item).Dan.Naziv); } }
static void Main(string[] args) { Box box = new Box(); box.AddProduct(new Product("Monopoly", 80)); box.AddProduct(new Product("Player's Unknown Battlegrounds", 200)); box.AddProduct(new Product("Coffee mug", 20)); IAbstractIterator iterator = box.GetIterator(); for (Product product = iterator.First(); iterator.IsDone == false; product = iterator.Next()) { Console.WriteLine(product.ToString()); } }
static void Main(string[] args) { Notebook notebook = new Notebook(); notebook.AddNote(new Note("Test title1", "test,test!")); notebook.AddNote(new Note("Test title2", "test,test!")); notebook.AddNote(new Note("Test title3", "test,test!")); IAbstractIterator iterator = notebook.GetIterator(); for (Note note = iterator.First(); iterator.IsDone == false; note = iterator.Next()) { note.Show(); } }
static void Main(string[] args) { Product shirt = new Product("100% cotton", 100); Product videoGame = new Product("PG-13", 300); Product shoes = new Product("yeezy", 10000); Box box = new Box(); box.AddProduct(shirt); box.AddProduct(videoGame); box.AddProduct(shoes); IAbstractIterator iterator = box.GetIterator(); for (Product product = iterator.First(); iterator.IsDone == false; product = iterator.Next()) { Console.WriteLine(product.ToString()); } }
static void Main(string[] args) { Note schoolNote = new Note("Study schedule", "programming, english"); Note gymNote = new Note("no pain no gain", "100 push ups, 100 sit ups"); Note morningNote = new Note("Good morning!", "You can do this!"); Notebook notebook = new Notebook(); notebook.AddNote(schoolNote); notebook.AddNote(gymNote); notebook.AddNote(morningNote); IAbstractIterator iterator = notebook.GetIterator(); for (Note note = iterator.First(); iterator.IsDone == false; note = iterator.Next()) { note.Show(); } }
static void Main(string[] args) { var myNotes = new List <Note>() { new Note("prva biljeska", "korona"), new Note("druga biljeska", "karantena"), }; Notebook myNotebook = new Notebook(myNotes); Note myNewNote = new Note("treca biljeska", "samoizolacija"); myNotebook.AddNote(myNewNote); IAbstractIterator iterator = myNotebook.GetIterator(); Note toPrint; for (toPrint = iterator.First(); iterator.IsDone == false; toPrint = iterator.Next()) { toPrint.Show(); } }
static void Main(string[] args) { var myProducts = new List <Product>() { new Product("prvi proizvod", 1.23), new Product("drugi proizvod", 4.56), }; Box myBox = new Box(myProducts); Product myNewProduct = new Product("treci proizvod", 7.89); myBox.AddProduct(myNewProduct); IAbstractIterator iterator = myBox.GetIterator(); Product toPrint; for (toPrint = iterator.First(); iterator.IsDone == false; toPrint = iterator.Next()) { Console.WriteLine(toPrint.ToString()); } }
public int Prihod() { IzracunPrihoda izracun = new IzracunPrihoda(); IAbstractIterator iterator = this.CreateIterator(); IRasporedEmisija raspored = iterator.First(); while (!iterator.IsDone) { var vrsta = ((EmitiranjeEmisija)raspored).Emisija.VrstaEmisije; if (vrsta != null) { if (((EmitiranjeEmisija)raspored).Emisija.vrsta.Reklama == 1) { izracun.posjeti(((EmitiranjeEmisija)raspored).Emisija.vrsta); } } raspored = iterator.Next(); } return(izracun.getUkupanPrihod()); }
static void Main(string[] args) { Box box = new Box(); Product product1 = new Product("Product1", 1); Product product2 = new Product("Product2", 2); Product product3 = new Product("Product3", 3); box.AddProduct(product1); box.AddProduct(product2); box.AddProduct(product3); IAbstractIterator iterator = box.GetIterator(); Product currentProduct = iterator.First(); while (iterator.IsDone == false) { Console.WriteLine(currentProduct.ToString()); currentProduct = iterator.Next(); } }
static void Main(string[] args) { Notebook notebook = new Notebook(); Note note1 = new Note("Title1", "Text1"); Note note2 = new Note("Title2", "Text2"); Note note3 = new Note("Title3", "Text3"); notebook.AddNote(note1); notebook.AddNote(note2); notebook.AddNote(note3); IAbstractIterator iterator = notebook.GetIterator(); Note currentNote = iterator.First(); while (iterator.IsDone == false) { currentNote.Show(); currentNote = iterator.Next(); } }
static void Main(string[] args) { //1. zadatak List <Note> notes = new List <Note>(); notes.Add(new Note("Note 1", "Text 1")); notes.Add(new Note("Note 2", "Text 2")); notes.Add(new Note("Note 3", "Text 3")); Notebook notebook = new Notebook(notes); IAbstractIterator iterator = notebook.GetIterator(); for (Note note = iterator.First(); !iterator.IsDone; note = iterator.Next()) { note.Show(); } //2. Zadatak List <Product> products = new List <Product>(); products.Add(new Product("Product 1", 4)); products.Add(new Product("Product 2", 7)); products.Add(new Product("Product 3", 14)); Box box = new Box(products); /*IAbstractIterator iterator = box.GetIterator(); * for (Product product = iterator.First(); !iterator.IsDone; product = iterator.Next()) * { * Console.WriteLine(product.ToString()); * }*/ //3. Zadatak ToDoItem toDoItem = new ToDoItem("Razvoj programske podrške objektno orijentiranim načelima", "Predati zadaću.", new DateTime(2020, 6, 3, 20, 00, 00)); CareTaker careTaker = new CareTaker(); careTaker.SetLast(toDoItem.StoreState()); toDoItem.Rename("Predati sve labose"); toDoItem.ChangeTask("Naučiti za predrok."); toDoItem.ChangeTimeDue(new DateTime(2020, 6, 5, 17, 00, 00)); careTaker.SetLast(toDoItem.StoreState()); toDoItem.Rename("Napraviti i predati seminar"); toDoItem.ChangeTask("Usmeni ispit"); toDoItem.ChangeTimeDue(new DateTime(2020, 6, 15, 22, 00, 00)); careTaker.SetLast(toDoItem.StoreState()); toDoItem.Rename("Učiti za ispitne rokove"); toDoItem.ChangeTask("Položiti kolegije na ispitnim rokovima."); toDoItem.ChangeTimeDue(new DateTime(2020, 6, 28, 16, 59, 59)); Console.WriteLine(toDoItem.ToString()); //ispisuje se zadnje stanje koje je dodano toDoItem.RestoreState(careTaker.GetLast()); Console.WriteLine(toDoItem.ToString()); //ispisuje se treće stanje toDoItem.RestoreState(careTaker.GetLast()); Console.WriteLine(toDoItem.ToString()); //ispisuje se drugo stanje toDoItem.RestoreState(careTaker.GetLast()); Console.WriteLine(toDoItem.ToString()); //ispisuje se prvo stanje Console.ReadKey(); //4. Zadatak BankAccount account = new BankAccount("Domagoj Voćanec", "Ulica Prva desno", 7500); Console.WriteLine(account.ToString()); Memento bankAccountSave = account.Store(); account.ChangeOwnerAddress(" Ulica Prva lijevo "); account.UpdateBalance(+2500); Console.WriteLine("\n" + account.ToString() + "\n"); account.Restore(bankAccountSave); Console.WriteLine(account.ToString()); Console.ReadKey(); }