From 07dd303c20773b4c2e73ab57a47451d2ba57fb66 Mon Sep 17 00:00:00 2001 From: Stevo5o Date: Sun, 28 Jun 2015 14:37:02 +0100 Subject: [PATCH] More Q --- Lesson5/OOP/CsharpQuestions.txt | 15 ++++++++++++++- Lesson5/OOP/Form1.cs | 28 +++++++++++++++++++--------- README.md | 6 +++++- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Lesson5/OOP/CsharpQuestions.txt b/Lesson5/OOP/CsharpQuestions.txt index 2a7d869..b2a237c 100644 --- a/Lesson5/OOP/CsharpQuestions.txt +++ b/Lesson5/OOP/CsharpQuestions.txt @@ -24,4 +24,17 @@ 13. Name some usages of the "this" keyword in C#? -14. On this sheet, what line number is the word set? \ No newline at end of file +14. On this sheet, what line number is the word set? + +15. Write a string game, with the following items "Arya", "Tyrion", "Yara", "Daenerys", "Ramsay", "Joffrey" + Write code to loop through the array. Create a pop-up messsage box to display each one of the names /items. + +16. + +17. What is a variable (var) give a real world example of a variable? + +18. Create a combo with the following list of names "Arya", "Tyrion", "Yara", "Daenerys" write the code that displays a pop-up with either "You picked Tyrion!" else "I'm not sure who you picked." + +19. + +20. \ No newline at end of file diff --git a/Lesson5/OOP/Form1.cs b/Lesson5/OOP/Form1.cs index 2152b9b..fc1b7d1 100644 --- a/Lesson5/OOP/Form1.cs +++ b/Lesson5/OOP/Form1.cs @@ -22,20 +22,30 @@ public Form1() private void button2_Click(object sender, EventArgs e) { - + string[] game = { "Arya", "Tyrion", "Yara", "Daenerys", "Ramsay", "Joffrey" }; - // Vehicle myCar = new Vehicle(); // new keyword, break point /debug here - myCar.Make = "DeLorean"; - myCar.Model = "Time Machine"; - myCar.ElapsedMilage = 9999969; + //for (int i = 0; i < game.Length; i++) + //{ + // MessageBox.Show(game[i].ToString()); + //} - if(myCar.Make == "DeLorean") + foreach (var person in game) { - string myModel; - myModel = myCar.Model; + MessageBox.Show(person); } - MessageBox.Show(myModel); + // Vehicle myCar = new Vehicle(); // new keyword, break point /debug here + //myCar.Make = "DeLorean"; + //myCar.Model = "Time Machine"; + //myCar.ElapsedMilage = 9999969; + + //if(myCar.Make == "DeLorean") + //{ + // string myModel; + // myModel = myCar.Model; + //} + + //MessageBox.Show(myModel); //string result; //result = myCar.Drive(30); diff --git a/README.md b/README.md index a1da6b9..f24bde8 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,8 @@ Two nested for loops
For with if
For with switch
###Lesson 5 -OOP +OOP
+-read from file +-try catch +-QA +-IO