Presentation is loading. Please wait.

Presentation is loading. Please wait.

Console.WriteLine(“Good luck!”);

Similar presentations


Presentation on theme: "Console.WriteLine(“Good luck!”);"— Presentation transcript:

1

2 Console.WriteLine(“Good luck!”);
PC01 Term 3 Test Console.WriteLine(“Good luck!”);

3 This term we have covered:
Introduction This term we have covered: Static functions Parameters Returning from functions Creating classes …And using instance functions It’s time to test your knowledge!

4 Create a new static function
Test Exercise 1 Make a new project Create a new static function Call it Max It should accept two integers, a and b And return an integer as well Inside the function, add an if statement If a is greater than b, return a Otherwise, return b

5 Create another function
Test Exercise 1 Create another function Call it Square It should accept an integer number called “n” Doesn’t return anything Inside the function, use two nested for loops to print a n * n square to the console Hint: use both Console.Write(“#”) and Console.WriteLine()

6 Call this class “Kitten”
Test Exercise 2 Create a new class Call this class “Kitten” Give it an integer attribute called “cuteness” 4. Add a constructor that outputs “Making a new kitten!” to the console

7 Add a function to your Kitten class:
Test Exercise 3 Add a function to your Kitten class: Call it “Meow” Doesn’t return anything Accepts an integer number 2. This function should use a for loop that prints “Meow! ” to the console 3. Use the number you pass to the function as the limit

8 In Main, create a new Kitten instance Create a random number generator
Test Exercise 4 In Main, create a new Kitten instance Create a random number generator Call its “Meow” function using a random number between 1 and 10 Print the result of calling “Max” using two random numbers between 0 and 100 Call your Square function using a random number between 1 and 5

9 Move on to the next slide for some extra exercises
END OF TEST Move on to the next slide for some extra exercises

10 Option #1: Option #2: Create a list of Kittens
Test Extension Option #1: Create a list of Kittens Fill it with five kittens with different cuteness Sort the list using the Bubble Sort algorithm Option #2: Create two classes for two super heroes Give both of them an attribute for health Make a battle program, where superheroes attack each other Use random numbers for dealing damage


Download ppt "Console.WriteLine(“Good luck!”);"

Similar presentations


Ads by Google