bool Start() { LingoGame lingoGame = new LingoGame(); lingoGame.Init(); Console.Clear(); PlayLingo(lingoGame); return(ProgramTools.LoopProgram()); }
bool Start() { Console.Write("Enter a sentence: "); string sentence = Console.ReadLine(); sentence = ShuffleWords(sentence); Console.WriteLine("The new sentence has become: " + sentence); return(ProgramTools.LoopProgram()); }
bool Start() { Position position = new Position(); ChessPiece[,] chessboard = new ChessPiece[8, 8]; InitChessboard(chessboard); DisplayChessboard(chessboard); PlayChess(chessboard); return(ProgramTools.LoopProgram()); }
bool Start() { RegularCandies[,] playingField; Position posRow = new Position(); Position posCol = new Position(); if (File.Exists("playingField.txt")) { playingField = ReadPlayingField("playingField.txt"); } else { playingField = new RegularCandies[10, 10]; InitCandies(playingField); WritePlayingField(playingField, "playingField.txt"); } DisplayCandies(playingField); Console.WriteLine(); if (ScoreRowPresent(playingField, out posRow)) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Row score! "); Console.ResetColor(); Console.WriteLine($"First position: ({posRow.column}, {posRow.row})"); } else { Console.WriteLine("No row score."); } Console.WriteLine(); if (ScoreColumnPresent(playingField, out posCol)) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Column score! "); Console.ResetColor(); Console.WriteLine($"First position: ({posCol.column}, {posCol.row})"); } else { Console.WriteLine("No column score."); } if (RemoveSaveFile()) { File.Delete("playingField.txt"); Console.WriteLine("Your safe file has been succesfully deleted."); } return(ProgramTools.LoopProgram()); }
bool Start() { DeckOfCards deck = new DeckOfCards(); Console.WriteLine("Ordered:"); deck.Print(); Console.WriteLine(); Console.WriteLine("Randomised:"); deck.Shuffle(); deck.Print(); return(ProgramTools.LoopProgram()); }
bool Start() { List <Premise> premises = ReadPremises("..\\..\\premises.txt"); List <Party> parties = ReadParties("..\\..\\parties.txt"); if (premises.Count < 1 || parties.Count < 1) { return(false); } string user = ProcessPremises(premises); CompareParties(user, parties); return(ProgramTools.LoopProgram()); }
bool Start() { Dictionary <string, string> words = new Dictionary <string, string>(); if (SetLanguage()) { words = ReadWords("..//..//dictionaryNL.csv", "nl"); } else { words = ReadWords("..//..//dictionaryENG.csv", "eng"); } TranslateWords(words); return(ProgramTools.LoopProgram()); }
bool Start() { int value = ReadTools.ReadInt("Enter a value: "); Console.WriteLine("You entered {0}.", value); int age = ReadTools.ReadInt("How old are you? ", 0, 120); Console.WriteLine("You are {0} years old.", age); string name = ReadTools.ReadString("What is your name? "); Console.WriteLine("Nice meeting you {0}.", name); return(ProgramTools.LoopProgram()); }
bool Start() { Console.Write("Enter a word (to search): "); string searchTerm = Console.ReadLine(); while (searchTerm.Length < 1) { Console.Write("Enter a word (to search): "); searchTerm = Console.ReadLine(); } int numWord = SearchWordInFile("..//..//tweets-donaldtrump-2018.txt", searchTerm, out int numLines); Console.WriteLine("Word occurence: " + numWord); Console.WriteLine("Number of lines containing the word: " + numLines); return(ProgramTools.LoopProgram()); }
bool Start() { Programmer p1 = new Programmer("Hank", Specialty.PHP); Programmer p2 = new Programmer("Peter", Specialty.Java); Programmer p3 = new Programmer("Samantha", Specialty.HTML); Programmer p4 = new Programmer("Astrid"); p1.Print(); Team team = new Team(); team.AddProgrammer(p1); team.AddProgrammer(p2); team.AddProgrammer(p3); team.AddProgrammer(p4); team.PrintAllTeamMembers(); return(ProgramTools.LoopProgram()); }
bool Start() { BookStore bookStore = new BookStore(); Book book1 = new Book("Dracula", "Bram Stoker", 15); Book book2 = new Book("Joe Speedboot", "Tommy Wieringa", 12.5); Book book3 = new Book("The Hobbit", "J.R.R. Tolkien", 12.5); Magazine magazine1 = new Magazine("Time", DayOfWeek.Friday, 3.9); Magazine magazine2 = new Magazine("Donald Duck", DayOfWeek.Thursday, 2.5); bookStore.Add(book1); bookStore.Add(book2); bookStore.Add(magazine1); bookStore.Add(magazine2); bookStore.Add(book3); bookStore.PrintCompleteStock(); return(ProgramTools.LoopProgram()); }
bool Start() { int[,] matrix = new int[5, 10]; matrix = FillMatrix(matrix); DisplayMatrix(matrix); Console.WriteLine(); int num = ReadTools.ReadInt("Enter a search number: "); while (!numberPresent(matrix, num)) { Console.WriteLine("That number is not present in the matrix, try another one."); num = ReadTools.ReadInt("Enter a search number: "); } matrix = shiftmatrix(matrix, num); Console.WriteLine(); Console.WriteLine("Shifting rows..."); Console.WriteLine(); DisplayMatrix(matrix); return(ProgramTools.LoopProgram()); }
bool Start() { Person person = new Person(); Console.Write("Enter your name: "); string name = Console.ReadLine(); if (File.Exists($"{name}.txt")) { Console.WriteLine($"Nice to see you again, {name}!"); Console.WriteLine($"We have the following information about you:"); person = ReadPerson($"{name}.txt"); DisplayPerson(person); } else { Console.WriteLine($"Welcome {name}!"); person = ReadPerson(); WritePerson(person, $"{person.name}.txt"); Console.WriteLine("Your data is written to file."); } return(ProgramTools.LoopProgram()); }
bool Start() { return(ProgramTools.LoopProgram()); }
bool Start() { Customer customer1 = new Customer("Lionel Messi", Convert.ToDateTime("1987/06/24")); Customer customer2 = new Customer("Piet Paulusma", Convert.ToDateTime("1956/02/15")); customer2.DateOfRegistration = Convert.ToDateTime("2017/02/20"); try { PrintCustomer(customer1); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine(); try { PrintCustomer(customer2); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine(); Ticket ticket1 = new Ticket("", 1, DateTime.ParseExact("25-02-20 18:30", "dd-MM-yy HH:mm", null), 10.5m, 0); Ticket ticket2 = new Ticket("Dracula", 7, DateTime.ParseExact("25-02-20 18:30", "dd-MM-yy HH:mm", null), 10.5m, 0); Ticket ticket3 = new Ticket("Star Wars", 1, DateTime.ParseExact("25-02-20 18:30", "dd-MM-yy HH:mm", null), 10.5m, 13); Ticket ticket4 = new Ticket("Dracula", 1, DateTime.ParseExact("25-02-20 18:15", "dd-MM-yy HH:mm", null), 10.5m, 0); Ticket ticket5 = new Ticket("Dracula", 2, DateTime.ParseExact("26-02-20 18:30", "dd-MM-yy HH:mm", null), 10.5m, 6); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Creating tickets"); Console.ResetColor(); try { PrintTicket(ticket1); } catch (Exception e) { Console.WriteLine(e.Message); } try { PrintTicket(ticket2); } catch (Exception e) { Console.WriteLine(e.Message); } try { PrintTicket(ticket3); } catch (Exception e) { Console.WriteLine(e.Message); } try { PrintTicket(ticket4); } catch (Exception e) { Console.WriteLine(e.Message); } try { PrintTicket(ticket5); } catch (Exception e) { Console.WriteLine(e.Message); } Ticket ticket6 = new Ticket("Green Book", 5, DateTime.ParseExact("24-02-20 19:00", "dd-MM-yy HH:mm", null), 10.5m, 12); Ticket ticket7 = new Ticket("The prodigy", 3, DateTime.ParseExact("23-02-20 17:30", "dd-MM-yy HH:mm", null), 10.5m, 16); Console.WriteLine(); Reservation reservation1 = new Reservation(customer1, ticket6); reservation1.Add(ticket7); reservation1.Add(ticket5); PrintReservation(reservation1); Console.WriteLine(); Reservation reservation2 = new Reservation(customer2, ticket5); reservation2.Add(ticket6); reservation2.Add(ticket7); PrintReservation(reservation2); return(ProgramTools.LoopProgram()); }
bool Start() { Book book1 = new Book(1, "Dracula", "Bram Stoker"); Book book2 = new Book(2, "Joe Speedboot", "Tommy Wieringa"); Book book3 = new Book(3, "The Hobbit", "J.R.R. Tolkien"); Customer customer1 = new Customer(1, "Lionel", "Messi", "*****@*****.**"); Customer customer2 = new Customer(2, "Piet", "Paulusma", "*****@*****.**"); Reservation reservation1 = new Reservation(1, customer1, book1); Reservation reservation2 = new Reservation(1, customer1, book3); Reservation reservation3 = new Reservation(1, customer2, book2); Reservation reservation4 = new Reservation(1, customer2, book1); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Books"); Console.ResetColor(); Console.WriteLine(book1); Console.WriteLine(book2); Console.WriteLine(book3); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Customers"); Console.ResetColor(); Console.WriteLine(customer1); Console.WriteLine(customer2); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Reservations"); Console.ResetColor(); Console.WriteLine(reservation1); Console.WriteLine(reservation2); Console.WriteLine(reservation3); Console.WriteLine(reservation4); Console.WriteLine(); CustomerDAO customerDAO = new CustomerDAO(); foreach (Customer cust in customerDAO.GetAll()) { Console.WriteLine(cust); } Customer customer = customerDAO.GetById(2); Console.WriteLine(); Console.WriteLine("Searching for customer with id 2..."); if (customer != null) { Console.WriteLine(customer); } else { Console.WriteLine("Customer not found!"); } Console.WriteLine(); BookDAO bookDAO = new BookDAO(); foreach (Book b in bookDAO.GetAll()) { Console.WriteLine($"{b.Id}. {b}"); } Book book = bookDAO.GetById(2); Console.WriteLine(); Console.WriteLine("Searching for book with id 2..."); if (book != null) { Console.WriteLine(book); } else { Console.WriteLine("Book not found!"); } Console.WriteLine(); ReservationDAO reservationDAO = new ReservationDAO(); foreach (Reservation res in reservationDAO.GetAll()) { Console.WriteLine(res); } List <Book> books = reservationDAO.GetAllForCustomer(customerDAO.GetById(2)); Console.WriteLine(); Console.WriteLine("Searching for books reserved by customer with id 2..."); if (books.Count != 0) { foreach (Book b in books) { Console.WriteLine(b); } } else { Console.WriteLine("Books not found!"); } List <Customer> customers = reservationDAO.GetAllForBook(bookDAO.GetById(3)); Console.WriteLine(); Console.WriteLine("Searching for customers who reserved book with id 3..."); if (customers.Count != 0) { foreach (Customer cust in customers) { Console.WriteLine(cust); } } else { Console.WriteLine("Customers not found!"); } return(ProgramTools.LoopProgram()); }