From 4bbc1e0af1728f00b3f03483add1c913fd7ee1b3 Mon Sep 17 00:00:00 2001 From: leggant <61127354+leggant@users.noreply.github.com> Date: Tue, 5 May 2020 11:31:23 +1200 Subject: [PATCH 01/13] Update to Readme Added update that reflects the ideas for the program so far. --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index e63ddd3..0c2273c 100644 --- a/README.md +++ b/README.md @@ -15,18 +15,10 @@ The programme never ends – it can go back and re-ask questions and overwrite p The “AI” picks up on inconsistent answers (e.g. if the user answers one question with a yes and later contradicts this, the AI will respond accordingly) Ideas for the “AI”: -IT support person -Doctor -Psychiatrist -Journalist -Teacher +Decision has been made to create a AI that will check in with the user and find out how they are. Based on their reply the AI will ask a series of follow-up questions that will push the user to explore..... Your team will present its programme in a team presentation after the mini-project. How do you hand it in? This time you are going to take a much more technical approach to group work. Your team should work in a shared repo in GitHub. Each team member will work in their own clone of this repo and push their changes to the remote to integrate their work. Make sure you commit often and that your commit messages communicate effectively to your team about what you have changed. You should all use plenty of code commenting. - -## Task 2 - -Game From 854203150731e5d38743a860acef85edda49b61a Mon Sep 17 00:00:00 2001 From: chooke Date: Tue, 5 May 2020 11:40:12 +1200 Subject: [PATCH 02/13] Create sasd.txt --- sasd.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sasd.txt diff --git a/sasd.txt b/sasd.txt new file mode 100644 index 0000000..e69de29 From 62bfd778d37d20eb308ab870c30590798c804baa Mon Sep 17 00:00:00 2001 From: chooke Date: Tue, 5 May 2020 11:41:34 +1200 Subject: [PATCH 03/13] Revert "Create sasd.txt" This reverts commit 854203150731e5d38743a860acef85edda49b61a. --- sasd.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 sasd.txt diff --git a/sasd.txt b/sasd.txt deleted file mode 100644 index e69de29..0000000 From 1fe385081a2053a9604ce0617efb37f0468a7515 Mon Sep 17 00:00:00 2001 From: leggant <61127354+leggant@users.noreply.github.com> Date: Tue, 5 May 2020 12:00:12 +1200 Subject: [PATCH 04/13] Starting into text --- .../TeamAProfessionalPracticeGroupProject/PPGroupProject.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index fcafd74..7e577d2 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -6,6 +6,11 @@ class PPGroupProject { static void Main() { + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine("################################################################"); + Console.Write("###########Welcome, This Program is Here To Help You!\nCovid-19 Lockdown has been tough, so we are here to check in."); + Console.WriteLine("################################################################"); + Console.ForegroundColor = ConsoleColor.White; Console.ReadLine(); } } From 2fe2eb39c94c683b265c3b61fa52a9694ee7957d Mon Sep 17 00:00:00 2001 From: leggant <61127354+leggant@users.noreply.github.com> Date: Tue, 5 May 2020 12:08:37 +1200 Subject: [PATCH 05/13] Tidied up intro text --- .../TeamAProfessionalPracticeGroupProject/PPGroupProject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index 7e577d2..530e061 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -8,7 +8,7 @@ static void Main() { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("################################################################"); - Console.Write("###########Welcome, This Program is Here To Help You!\nCovid-19 Lockdown has been tough, so we are here to check in."); + Console.WriteLine("###########Welcome, This Program is Here To Help You!###########\nCovid-19 Lockdown has been tough, so we are here to check in."); Console.WriteLine("################################################################"); Console.ForegroundColor = ConsoleColor.White; Console.ReadLine(); From 956844942826669b6d94a07100d684679b962ef3 Mon Sep 17 00:00:00 2001 From: leggant <61127354+leggant@users.noreply.github.com> Date: Tue, 5 May 2020 16:49:23 +1200 Subject: [PATCH 06/13] Updated text string and added the System.IO class for importing text files later --- .../PPGroupProject.cs | 3 +++ .../TeamAProfessionalPracticeGroupProject.csproj | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index 530e061..eab1d1f 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -1,4 +1,5 @@ using System; +using System.IO; // For Importing Text Strings From Text Files namespace TeamAProfessionalPracticeGroupProject { @@ -11,6 +12,8 @@ static void Main() Console.WriteLine("###########Welcome, This Program is Here To Help You!###########\nCovid-19 Lockdown has been tough, so we are here to check in."); Console.WriteLine("################################################################"); Console.ForegroundColor = ConsoleColor.White; + + Console.ReadLine(); } } diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject.csproj b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject.csproj index c73e0d1..6e2af38 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject.csproj +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject.csproj @@ -5,4 +5,13 @@ netcoreapp3.1 + + + PreserveNewest + + + PreserveNewest + + + From f32566f2289117b7f126412c290d1d237460e740 Mon Sep 17 00:00:00 2001 From: chooke Date: Tue, 5 May 2020 17:07:24 +1200 Subject: [PATCH 07/13] prototype --- .../PPGroupProject.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index eab1d1f..4afe613 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -12,7 +12,32 @@ static void Main() Console.WriteLine("###########Welcome, This Program is Here To Help You!###########\nCovid-19 Lockdown has been tough, so we are here to check in."); Console.WriteLine("################################################################"); Console.ForegroundColor = ConsoleColor.White; - + Console.WriteLine("Please Enter your name :"); + string NameInput = Console.ReadLine(); + Console.Write($"Hi {NameInput}"); + Console.WriteLine("On scale of 1 to 10 how you feeling today??"); + int userchoice = Convert.ToInt32(Console.ReadLine()); + switch (userchoice) + { + case 1: + Console.WriteLine("you need moto"); + break; + case 2: + Console.WriteLine("you need moto"); + break; + case 3: + Console.WriteLine("you need moto"); + break; + case 4: + Console.WriteLine("you need moto"); + break; + case 5: + Console.WriteLine("you need moto"); + break; + default: + Console.WriteLine("bb"); + break; + } Console.ReadLine(); } From 88964516958427170af1f7370b30dea3deb43df3 Mon Sep 17 00:00:00 2001 From: leggant <61127354+leggant@users.noreply.github.com> Date: Wed, 6 May 2020 11:47:34 +1200 Subject: [PATCH 08/13] Completed the script to add external text file content in to the program. These are loaded in to seperate arrays which can be referenced later. The arrays may need to be changed in to multi dimensional arrays to account for the different categories of questions and answers. Or these could be split in to seperate text files that are loaded in to seperate additional arrays . --- .../AnswerStrings.txt | 6 ++- .../PPGroupProject.cs | 49 ++++++++++++++++--- .../QuestionStrings.txt | 6 ++- 3 files changed, 52 insertions(+), 9 deletions(-) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/AnswerStrings.txt b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/AnswerStrings.txt index 5f28270..da16810 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/AnswerStrings.txt +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/AnswerStrings.txt @@ -1 +1,5 @@ - \ No newline at end of file +Happy Answers + +Negative Answers + +Urgent Medical Attention Answers \ No newline at end of file diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index 4afe613..4e2c327 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -7,16 +7,51 @@ class PPGroupProject { static void Main() { + // Variable Declarations + string[] questions = new string[10]; + string[] answers = new string[10]; + int userchoice; + string NameInput, temp = ""; + string hashlines = "################################################################"; + string welcomeText = "###########Welcome, This Program is Here To Help You!###########\nCovid-19 Lockdown has been tough, so we are here to check in."; + + //Start Program + // Welcome User & Ask for their name + Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine("################################################################"); - Console.WriteLine("###########Welcome, This Program is Here To Help You!###########\nCovid-19 Lockdown has been tough, so we are here to check in."); - Console.WriteLine("################################################################"); + Console.WriteLine(hashlines); + Console.WriteLine(welcomeText); + Console.WriteLine(hashlines); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Please Enter your name :"); - string NameInput = Console.ReadLine(); - Console.Write($"Hi {NameInput}"); - Console.WriteLine("On scale of 1 to 10 how you feeling today??"); - int userchoice = Convert.ToInt32(Console.ReadLine()); + NameInput = Console.ReadLine(); + Console.Write($"Hi {NameInput}, on scale of 1 to 10 how you feeling today?? "); + userchoice = Convert.ToInt32(Console.ReadLine()); + + //Loading text string data in to an array here. + + StreamReader questionsTextFileReader = new StreamReader("QuestionStrings.txt"); + StreamReader answersTextFileReader = new StreamReader("AnswerStrings.txt"); + + while (temp != null) + { + for (int i = 0; i < questions.Length; i++) + { + temp = questionsTextFileReader.ReadLine(); + questions[i] = temp; + } + for (int i = 0; i < answers.Length; i++) + { + temp = answersTextFileReader.ReadLine(); + answers[i] = temp; + } + } + questionsTextFileReader.Close(); + answersTextFileReader.Close(); + //Console.WriteLine(questions[0]); + //Console.WriteLine(answers[0]); + // Arrays are now populated with text content from external text files. + switch (userchoice) { case 1: diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/QuestionStrings.txt b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/QuestionStrings.txt index 5f28270..73c0dfb 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/QuestionStrings.txt +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/QuestionStrings.txt @@ -1 +1,5 @@ - \ No newline at end of file +Happy Questions + +Negative Questions + +Urgent Medical Attention Questions \ No newline at end of file From 73ed5830c994801f89dbdd528b18f0002c88b00c Mon Sep 17 00:00:00 2001 From: chooke Date: Wed, 6 May 2020 15:28:37 +1200 Subject: [PATCH 09/13] first version of the software layout please have a look and test the program to have a better understanding of what we need and what needs to be done . --- .../PPGroupProject.cs | 107 +++++++++++++----- 1 file changed, 80 insertions(+), 27 deletions(-) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index 4e2c327..fa562f2 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -10,11 +10,11 @@ static void Main() // Variable Declarations string[] questions = new string[10]; string[] answers = new string[10]; - int userchoice; + string NameInput, temp = ""; string hashlines = "################################################################"; string welcomeText = "###########Welcome, This Program is Here To Help You!###########\nCovid-19 Lockdown has been tough, so we are here to check in."; - + //Start Program // Welcome User & Ask for their name @@ -25,14 +25,87 @@ static void Main() Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Please Enter your name :"); NameInput = Console.ReadLine(); - Console.Write($"Hi {NameInput}, on scale of 1 to 10 how you feeling today?? "); - userchoice = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine($"Hi {NameInput}, How you felling today? /n if you feeling ok enter 1 or enter 2 if you feel unwell"); + string userchoice = Console.ReadLine(); - //Loading text string data in to an array here. + switch (userchoice) + { + case "1": + + Console.WriteLine("what brings you here ?."); + Console.WriteLine("bored,need moto,need something to do "); + string firstQ = Console.ReadLine(); + + + switch (firstQ) + { + case "bored": + Console.WriteLine("quote"); + Console.WriteLine("there are plenty of thing to do , here are some "); + Console.WriteLine("have a good day a good day "); + break; + case "need moto": + Console.WriteLine("quote"); + Console.WriteLine("watch videos or study etc"); + Console.WriteLine("some text "); + break; + case "somthing to do": + Console.WriteLine("quote"); + Console.WriteLine("paly games "); + Console.WriteLine("have a good day a good day "); + break; + } + break; + + case "2": + + Console.WriteLine("How was you day toady"); + Console.WriteLine("(Good,Bad,very bad)??"); + string SecondQ = Console.ReadLine(); + + switch (SecondQ) + { + case "Good": + case "good": + Console.WriteLine("Had any problems with:"); + Console.WriteLine("(Family,Frinds,Relationship)"); + string secFQ = Console.ReadLine(); + + switch (secFQ) + { + case "family": + case "Family": + Console.WriteLine("provide help for problems with family "); + break; + + case "frinds": + case "Frinds": + case "frind": + Console.WriteLine("provide help for problems with frinds"); + break; + case "Relationship": + case "GF": + case "gf": + case "relationship": + Console.WriteLine("provide help for problems with relationships"); + break; + } + break; + } + break; + + + } + + + + + //Loading text string data in to an array here. + StreamReader questionsTextFileReader = new StreamReader("QuestionStrings.txt"); StreamReader answersTextFileReader = new StreamReader("AnswerStrings.txt"); - + while (temp != null) { for (int i = 0; i < questions.Length; i++) @@ -52,27 +125,7 @@ static void Main() //Console.WriteLine(answers[0]); // Arrays are now populated with text content from external text files. - switch (userchoice) - { - case 1: - Console.WriteLine("you need moto"); - break; - case 2: - Console.WriteLine("you need moto"); - break; - case 3: - Console.WriteLine("you need moto"); - break; - case 4: - Console.WriteLine("you need moto"); - break; - case 5: - Console.WriteLine("you need moto"); - break; - default: - Console.WriteLine("bb"); - break; - } + Console.ReadLine(); } From 22f80812c7804c92a631fe2d0e6b42493aacd31b Mon Sep 17 00:00:00 2001 From: leggant <61127354+leggant@users.noreply.github.com> Date: Thu, 7 May 2020 13:02:40 +1200 Subject: [PATCH 10/13] Update to Strings array --- .../TeamAProfessionalPracticeGroupProject/PPGroupProject.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index 4e2c327..fbfd1a7 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -50,7 +50,9 @@ static void Main() answersTextFileReader.Close(); //Console.WriteLine(questions[0]); //Console.WriteLine(answers[0]); - // Arrays are now populated with text content from external text files. + + + // Question and answer Arrays are now populated with text content from external text files. switch (userchoice) { From 36a66d37bffc42ba3a68be66b908a9799220440a Mon Sep 17 00:00:00 2001 From: leggant <61127354+leggant@users.noreply.github.com> Date: Thu, 7 May 2020 13:30:39 +1200 Subject: [PATCH 11/13] Added a temp name for the program in the welcome text line and in the namespace. Feel free to change this. --- .../TeamAProfessionalPracticeGroupProject/PPGroupProject.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index 8bfa8e8..7cdb9fb 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -1,7 +1,7 @@ using System; using System.IO; // For Importing Text Strings From Text Files -namespace TeamAProfessionalPracticeGroupProject +namespace CatchUp19 { class PPGroupProject { @@ -13,7 +13,7 @@ static void Main() string NameInput, temp = ""; string hashlines = "################################################################"; - string welcomeText = "###########Welcome, This Program is Here To Help You!###########\nCovid-19 Lockdown has been tough, so we are here to check in."; + string welcomeText = "###########Welcome, Catch-Up-19 is Here To Help You!###########\nCovid-19 Lockdown has been tough, so we are here to check in."; //Start Program // Welcome User & Ask for their name @@ -121,8 +121,6 @@ static void Main() } questionsTextFileReader.Close(); answersTextFileReader.Close(); - //Console.WriteLine(questions[0]); - //Console.WriteLine(answers[0]); // Question and answer Arrays are now populated with text content from external text files. From 56dc2234fb36b117b93f311033ae090ab497e318 Mon Sep 17 00:00:00 2001 From: chooke Date: Thu, 7 May 2020 15:30:12 +1200 Subject: [PATCH 12/13] added random functionality --- .../PPGroupProject.cs | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index 7cdb9fb..ca58cdf 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -25,34 +25,71 @@ static void Main() Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Please Enter your name :"); NameInput = Console.ReadLine(); - Console.WriteLine($"Hi {NameInput}, How you felling today? /n if you feeling ok enter 1 or enter 2 if you feel unwell"); + //ask the user for their name + Console.WriteLine($"Hi {NameInput}, How you felling today? \nif you feeling ok enter 1 or enter 2 if you feel unwell"); + //store the user information in a string string userchoice = Console.ReadLine(); - + //using switch to excute diffrent commands based on the user input switch (userchoice) { + //if the user enters 1 case "1": - + //ask the user for why using the app Console.WriteLine("what brings you here ?."); + //let the user pick a reason from the provided opions ,also we can expand these Console.WriteLine("bored,need moto,need something to do "); + //store the user choice in a string string firstQ = Console.ReadLine(); - + //switch the use choice switch (firstQ) { + //if the user pick bored case "bored": - Console.WriteLine("quote"); - Console.WriteLine("there are plenty of thing to do , here are some "); - Console.WriteLine("have a good day a good day "); + case "Bored": + case "boring": + //we can add random items in this array to be picked and display it to the user + Console.Write("there are plenty of things to do , how about you "); + Random rand = new Random(); + string[] x = { "play video games", "watch movies", "go clubing ", "Eat food", "listen to music" }; + int A = rand.Next(x.Length); + string[] y = { "study", "clean your room", "do push ups ", "sleep", "jump around " }; + int B = rand.Next(x.Length); + Console.WriteLine(x[A]); + while (true) + { + Console.WriteLine($"So {NameInput.ToUpper()} still bored? yes or no "); + string ans = Console.ReadLine(); + + if (ans == "yes") + { + Console.WriteLine($"why dont you try to {y[B]}"); + Console.WriteLine("we can add more things here"); + + } + else + { + Console.WriteLine("Great :)"); + Console.WriteLine("have a good day "); + + break; + } + } + break; + + + + case "need moto": - Console.WriteLine("quote"); + Console.WriteLine("text"); Console.WriteLine("watch videos or study etc"); Console.WriteLine("some text "); break; case "somthing to do": - Console.WriteLine("quote"); + Console.WriteLine("text"); Console.WriteLine("paly games "); - Console.WriteLine("have a good day a good day "); + Console.WriteLine("have a good day"); break; } break; @@ -96,7 +133,7 @@ static void Main() } - + @@ -121,8 +158,8 @@ static void Main() } questionsTextFileReader.Close(); answersTextFileReader.Close(); - - + + // Question and answer Arrays are now populated with text content from external text files. From 5149b7d9ec858f8abc16443a9e45f7756bbb1e77 Mon Sep 17 00:00:00 2001 From: leggant <61127354+leggant@users.noreply.github.com> Date: Fri, 8 May 2020 21:02:38 +1200 Subject: [PATCH 13/13] Moved the array script to the beginning of the program to be loaded before asking user for their name. --- .../PPGroupProject.cs | 58 ++++++++----------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs index ca58cdf..5af5d12 100644 --- a/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs +++ b/TeamAProfessionalPracticeGroupProject/TeamAProfessionalPracticeGroupProject/PPGroupProject.cs @@ -29,7 +29,32 @@ static void Main() Console.WriteLine($"Hi {NameInput}, How you felling today? \nif you feeling ok enter 1 or enter 2 if you feel unwell"); //store the user information in a string string userchoice = Console.ReadLine(); + + //Loading text string data in to an array here. + + StreamReader questionsTextFileReader = new StreamReader("QuestionStrings.txt"); + StreamReader answersTextFileReader = new StreamReader("AnswerStrings.txt"); + + while (temp != null) + { + for (int i = 0; i < questions.Length; i++) + { + temp = questionsTextFileReader.ReadLine(); + questions[i] = temp; + } + for (int i = 0; i < answers.Length; i++) + { + temp = answersTextFileReader.ReadLine(); + answers[i] = temp; + } + } + questionsTextFileReader.Close(); + answersTextFileReader.Close(); + + // Question and answer Arrays are now populated with text content from external text files. + //using switch to excute diffrent commands based on the user input + switch (userchoice) { //if the user enters 1 @@ -78,9 +103,6 @@ static void Main() break; - - - case "need moto": Console.WriteLine("text"); Console.WriteLine("watch videos or study etc"); @@ -131,39 +153,9 @@ static void Main() } break; - } - - - - //Loading text string data in to an array here. - - StreamReader questionsTextFileReader = new StreamReader("QuestionStrings.txt"); - StreamReader answersTextFileReader = new StreamReader("AnswerStrings.txt"); - - while (temp != null) - { - for (int i = 0; i < questions.Length; i++) - { - temp = questionsTextFileReader.ReadLine(); - questions[i] = temp; - } - for (int i = 0; i < answers.Length; i++) - { - temp = answersTextFileReader.ReadLine(); - answers[i] = temp; - } - } - questionsTextFileReader.Close(); - answersTextFileReader.Close(); - - - // Question and answer Arrays are now populated with text content from external text files. - - - Console.ReadLine(); } }