/// <summary> /// /// </summary> private static void EndGame() { Console.Clear(); SimpleIO.WriteTitle(Title, "Week 3"); Console.WriteLine("The overall winner is " + SPS_Game.Winner); }
/// <summary> /// This method will sort the numbers /// into numerical order /// </summary> public void SortNumbers() { Console.Clear(); SimpleIO.WriteTitle("Bubble Sort", "Task 5.4"); Console.WriteLine("Bubble Sort method"); for (int i = 0; (i <= (answer.Length - 1)) && flag; i++) { flag = false; for (int j = 0; j < (answer.Length - 1); j++) { if (answer[j + 1] > answer[j]) { temp = answer[j]; answer[j] = answer[j + 1]; answer[j + 1] = temp; flag = true; } } } foreach (int num in answer) { Console.Write("\t {0}", num); } Console.ReadLine(); }
/// <summary> /// In this method it will ask the user which measurement /// they would like to use and will store the measurements. /// </summary> public void GetDetails() { SimpleIO.WriteTitle("Body Mass Index", "Task 4.4"); do { Console.Write("Would you like to use the metric measurements (kg and metres) " + "or the imperial measurements (pounds and inches)? "); measurement = Console.ReadLine(); } while (measurement != "metric" && measurement != "imperial"); if (measurement == "metric") { Console.Write("What is your weight in kg? "); weight = Convert.ToDouble(Console.ReadLine()); Console.Write("What is your height in metres? "); height = Convert.ToDouble(Console.ReadLine()); } else { Console.Write("What is your weight in pounds? "); weight = Convert.ToDouble(Console.ReadLine()); Console.Write("What is your height in inches? "); height = Convert.ToDouble(Console.ReadLine()); } }
/// <summary> /// /// </summary> private void EndGame() { Console.Clear(); SimpleIO.WriteTitle(Title, "Week 3"); Console.WriteLine("The overall winner is " + game.WinnerName); }
/// <summary> /// This method gets the players choice, /// and shows the round number. /// </summary> private void GetPlayerChoice() { Console.Clear(); SimpleIO.WriteTitle(Title, "Week 3"); Console.WriteLine("Turn no " + turn + " of " + MAXN_TURNS); string[] choices = new string[] { ROCK, PAPER, SCISSORS }; int choiceNo = SimpleIO.GetChoice(choices); if (choiceNo == 1) { game.PlayerChoice = RPS_Choices.ROCK; } else if (choiceNo == 2) { game.PlayerChoice = RPS_Choices.PAPER; } else { game.PlayerChoice = RPS_Choices.SCISSORS; } Console.WriteLine(); }
/// <summary> /// This method allows the user to /// book a room /// </summary> public void BookRoom() { SimpleIO.WriteTitle("Bates Motel", "Task 5.6"); Console.WriteLine("\nThe Bates Motel"); Console.WriteLine("================="); Console.WriteLine("Book a room"); Console.Write("Enter the room number: "); do { roomNumber = Convert.ToInt32(Console.ReadLine()); if (rooms[roomNumber] != 0) { Console.WriteLine("Sorry this Room is already booked"); Console.Write("\nPlease pick a different Room : "); } } while (rooms[roomNumber] != 0); Console.Write("How many guests : "); do { guests = Convert.ToInt32(Console.ReadLine()); if (guests > MAXN_GUESTS) { Console.WriteLine("You can only have less then 4 guests booked within room " + roomNumber); Console.Write("How many guests : "); } }while (guests > MAXN_GUESTS); rooms[roomNumber] = guests; totalGuests += guests; roomsBooked++; }
/// <summary> /// This method will vacate all the rooms /// in the motel /// </summary> public void VacateAllRooms() { SimpleIO.WriteTitle("Bates Motel", "Task 5.6"); Array.Clear(rooms, 0, rooms.Length); Console.WriteLine("All rooms have been vacated!"); }
/// <summary> /// This method will end the game /// and clear the screen and display /// the overall winner of the game /// </summary> private void EndGame() { Console.Clear(); SimpleIO.WriteTitle(Title, "Week 3"); game.OverallWinner(); }
/// <summary> /// ******************************************************* /// Asks for the user's name, begins the game. /// ******************************************************* /// </summary> public void StartGame() { Console.Write("What's your name? "); string userName = Console.ReadLine(); SimpleIO.WriteTitle(Title, "Week 3"); game.Start(userName); }
/// <summary> /// ******************************************************* /// This method will start the game and /// output the title /// ******************************************************* /// </summary> private void StartGame() { SimpleIO.WriteTitle(Title, "Week 3"); Console.WriteLine("What is your name?"); string userName = Console.ReadLine(); game.Start(userName); }
/// <summary> /// Asks for scores, and then stores it as an integer /// </summary> public void GetScores() { SimpleIO.WriteTitle("Enter Tournament Scores", "Task 5.1"); for (int index = 0; index < MAXN_SCORES; index++) { Console.Write("Enter score for player" + (index + 1) + " > "); scores[index] = Convert.ToInt32(Console.ReadLine()); } }
/// <summary> /// This method asks the user to /// input the numbers required for /// the array. /// </summary> public void InputNumbers() { SimpleIO.WriteTitle("Sorting", "5.4"); for (int i = 0; i < MAX_NUMBERS; i++) { Console.Write("Please enter a value. "); numbers[i] = Convert.ToInt32(Console.ReadLine()); } }
/// <summary> /// This method shows the numbers /// in their numerical order. /// </summary> public void Display() { Console.Clear(); SimpleIO.WriteTitle("Sorting", "5.4"); for (int i = 0; i < MAX_NUMBERS; i++) { Console.WriteLine(numbers[i]); } }
public void ShowScores() { SimpleIO.WriteTitle("Show Tournament Scores", "Task 5.1"); for (int i = 0; i < MAXN_SCORES; i++) { Console.WriteLine("Player " + (i + 1) + " scored " + scores[i]); } }
public void TrafficCount() { SimpleIO.WriteTitle("Traffic Survey", "5.5"); for (int i = 0; i < MAX_HOURS; i++) { Console.Write("Please enter the traffic count: "); hours[i] = Convert.ToInt32(Console.ReadLine()); } }
///summary> ///This method will ask the user for numbers to be inputed ///</summary> public void InputNumbers() { SimpleIO.WriteTitle("Bubble Sort", "Task 5.4"); Console.WriteLine("Please enter numbers to sort"); for (int i = 0; i < answer.Length; i++) { answer[i] = int.Parse(Console.ReadLine()); } Console.ReadKey(); }
/// <summary> /// This method will ask the user to enter their /// weight in kg and their height in metres /// </summary> public void GetDetails() { SimpleIO.WriteTitle("Body Mass Index Calculator", "4.4"); Console.WriteLine("Please enter your weight (kg):"); kg = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Please enter your height (m): "); height = Convert.ToDouble(Console.ReadLine()); }
/// <summary> /// This method displays all the rooms in the motel /// </summary> public void ShowAllRooms() { SimpleIO.WriteTitle("Bates Motel", "Task 5.6"); Console.WriteLine("Bates Motel Room Status"); Console.WriteLine("======================="); for (int i = 1; i < MAXN_ROOMS + 1; i++) { Console.WriteLine("Room " + i + "\t" + rooms[i] + " guests"); } Console.ReadKey(); }
/// <summary> /// This method will show the /// position /// </summary> public void ShowSongs() { SimpleIO.WriteTitle("UK Top 10 Chart Singles", "Task 5.2"); int position = 0; foreach (string song in chart) { position++; Console.WriteLine("Song " + position + " is " + song); } }
protected void loadFromDisk() { LogFormater.Info("Loading adverts from Disk", true); advertsBlob loadedAdverts = new advertsBlob(); advertConfig demoAdvert = new advertConfig(); demoAdvert.attachment = UUID.Zero.ToString(); demoAdvert.content = "Content"; demoAdvert.title = "Title"; demoAdvert.groups = new[] { UUID.Zero.ToString(), UUID.Zero.ToString() }; demoAdvert.days = "0,1,2,3,4,5,6"; demoAdvert.hour = "12"; demoAdvert.min = "30"; demoAdvert.notice = "false"; demoAdvert.enabled = "false"; loadedAdverts.adverts = new advertConfig[] { demoAdvert }; string targetfile = "adverts.json"; SimpleIO io = new SimpleIO(); io.ChangeRoot(controler.getFolderUsed()); if (SimpleIO.FileType(targetfile, "json") == false) { LogFormater.Status("Creating new adverts file", true); io.WriteJsonAdverts(loadedAdverts, targetfile); return; } if (io.Exists(targetfile) == false) { LogFormater.Status("Creating new adverts file", true); io.WriteJsonAdverts(loadedAdverts, targetfile); return; } string json = io.ReadFile(targetfile); if (json.Length > 0) { try { loadedAdverts = JsonConvert.DeserializeObject <advertsBlob>(json); foreach (advertConfig loaded in loadedAdverts.adverts) { Unpack(loaded); } } catch { io.MarkOld(targetfile); io.WriteJsonAdverts(loadedAdverts, targetfile); } return; } }
public ProcessFixes() { //new instance of MySQL communication class _myCommunicator = new MySQLCommunicator(); _myCommunicator.Password = SimpleIO.getClearText(@"connection.txt")[3]; //PDCore.Properties.Settings.Default.Password; _myCommunicator.Server = SimpleIO.getClearText(@"connection.txt")[0]; //PDCore.Properties.Settings.Default.Server; _myCommunicator.User = SimpleIO.getClearText(@"connection.txt")[2]; //PDCore.Properties.Settings.Default.User; _myCommunicator.Database = SimpleIO.getClearText(@"connection.txt")[1]; //PDCore.Properties.Settings.Default.Database; //Recieve database-errors _myCommunicator.MessageThrown += _myCommunicator_MessageThrown; }
/// <summary> /// This method allows the user to vacate /// one room /// </summary> public void VacateOneRoom() { SimpleIO.WriteTitle("Bates Motel", "Task 5.6"); Console.Write("Which Room would you like to vacate: "); roomNumber = Convert.ToInt32(Console.ReadLine()); totalGuests -= rooms[roomNumber]; rooms[roomNumber] = 0; Console.Write("Room " + roomNumber + " has been vacated"); roomsBooked -= 1; Console.ReadKey(); }
/// <summary> /// This method creates a the second chapter of a story using /// all the attributes of the class /// </summary> public void WriteChapter2() { SimpleIO.WriteTitle("Chapter Two", "Horror Story"); Console.WriteLine(" On Tuesday " + name + " was attacked by a thief in " + street + " out of her home. "); Console.WriteLine(" While " + name + " was running to escape, suddenly she heard " + noise + " , the police was there. "); Console.WriteLine(" Finally " + name + " was injured by " + thing + " in front the police. "); }
public void GetDetails() { SimpleIO.WriteTitle("Enter Tournament Scores", "Task 5.1"); for (int i = 0; i < MAXN_SCORES; i++) { Console.Write("Enter name for player " + (i + 1) + " > "); names[i] = Console.ReadLine(); Console.Write("Enter score for " + names[i] + " > "); scores[i] = Convert.ToInt32(Console.ReadLine()); } }
public void ShowVotes() { SimpleIO.WriteTitle("UK Top 10 Chart Singles", "Task 5.2"); int index = 0; foreach (string song in chart) { Console.Write("Song " + (index + 1) + " is " + song); Console.WriteLine(" No of votes is " + votes[index]); index++; } }
///<summary> ///This method will displey the numbers ///one above another. ///</summary> public void DisplayNumbers() { Console.Clear(); SimpleIO.WriteTitle("Bubble Sort", "Task 5.4"); Console.WriteLine("Array after sorting"); Array.Sort(answer); for (int i = 0; i < answer.Length; i++) { Console.WriteLine("Numbers" + answer[i]); } Console.ReadLine(); }
public void ShowVotes() { Console.Clear(); SimpleIO.WriteTitle("Votes for UK Top 10 Chart Singles", "Task 5.2"); for (int i = 0; i < MAXN_SONGS; i++) { string line = "Song " + (i + 1) + ": "; line = line + chart[i] + " has "; line = line + votes[i] + " votes"; Console.WriteLine(line); } }
/// <summary> /// This method creates a the first chapter of a story using /// all the attributes of the class /// </summary> public void WriteChapter1() { Console.Clear(); SimpleIO.WriteTitle("Horror Story", "4.2"); Console.WriteLine("It was a dark night in " + town + " and " + name + " could hear " + animal + "s screaming in the distance."); Console.WriteLine(name + " staggered terrified through the streets of " + town + ", realising " + gender + " had been followed."); Console.WriteLine("In the shadow of a doorway, a demented " + job + " waited, clutching a menacing " + weapon); }
public int GetVotes() { SimpleIO.WriteTitle("Vote for UK Top 10 Chart Singles", "Task 5.2"); Console.WriteLine("Enter 0 to quit"); Console.WriteLine(); int songNo = SimpleIO.GetInt("Enter song no: "); if (songNo > 0 && songNo < MAXN_SONGS) { votes[songNo - 1]++; } return(songNo); }
protected void loadRelayConfigFromFile() { JsonCustomRelays Demo = new JsonCustomRelays() { sourceFilter = "all", sourceType = "localchat", targetType = "groupchat", targetConfig = UUID.Zero.ToString() }; JsonCustomRelaysSet LoadedRelays = new JsonCustomRelaysSet { Entrys = new JsonCustomRelays[] { Demo } }; string targetfile = "customrelays.json"; SimpleIO io = new SimpleIO(); io.ChangeRoot(controler.getFolderUsed()); if (SimpleIO.FileType(targetfile, "json") == false) { io.WriteJsonRelays(LoadedRelays, targetfile); return; } if (io.Exists(targetfile) == false) { io.WriteJsonRelays(LoadedRelays, targetfile); return; } string json = io.ReadFile(targetfile); if (json.Length > 0) { try { LoadedRelays = JsonConvert.DeserializeObject <JsonCustomRelaysSet>(json); int loop = 1; foreach (JsonCustomRelays loaded in LoadedRelays.Entrys) { LogFormater.Info("Relay " + loop.ToString() + " [OK] sending to attach"); ApplyRelayConfig(loaded.sourceType, loaded.sourceFilter, loaded.targetType, loaded.targetConfig, loaded.encodeJson); loop++; } } catch { io.MarkOld(targetfile); io.WriteJsonRelays(LoadedRelays, targetfile); } return; } }