What's wrong with Easter jokes? They crack you up PC01 Term 1 Consolidation What's wrong with Easter jokes? They crack you up
Today we are going to consolidate everything we’ve learnt so far Introduction Today we are going to consolidate everything we’ve learnt so far Feel free to pick any topic you want All work should be done in the same solution
Index For loops Data validation While loops Arrays Problem solving Fixing errors Click me Click me Click me Click me Click me Click me
It should start at 10 and count down to 1 For loops Create a for loop It should start at 10 and count down to 1 Inside the loop, create a string variable and call it text Set it to counter + “ banana” Then, add an if statement It should check if counter is greater than 1 If it is, add “s” to text Print text to the console
Declare an integer variable and call it input Add a do while loop Data validation Declare an integer variable and call it input Add a do while loop It should print “Enter a number” to the console For the condition, use int.TryParse It should accept Console.ReadLine() and out input as parameters Do not forget about the exclamation mark at the front
It should go from 1 up to input (inclusive!) Data validation After the loop, create an integer variable called result and set it to 1 Then, add a for loop It should go from 1 up to input (inclusive!) Every iteration, it should take result and multiply it by the counter Finally, print result to the console Test your program, when you type 5 it should give you 120
Create an infinite loop Inside the loop, create two integer variables While Loops Create an infinite loop Inside the loop, create two integer variables Assign a random number between 1 and 13 to both of them Then, show both numbers to the user and ask them to enter their product Get the product from the console (to save time, you can use Convert.ToInt32 instead of int.TryParse) Break from the loop if the result is correct
Create an array of strings with 5 spaces Arrays Create an array of strings with 5 spaces Use a for loop to ask the user to enter their 5 different movies Add a for loop that shuffles them randomly It should run at least 15 times Every iteration it should pick two random elements and swap them Print the array after that using string.Join()
Create a program that checks if a string is a palindrome Problem solving Create a program that checks if a string is a palindrome A palindrome is a string that reads the same backward as forward, e .g. racecar or level There is more than one way to solve this problem You can reverse the string an then compare it with the original You can compare it character by character (text[0] with text[Length-1], text[1] with text[Length-2] and so on) Use whichever method you like!
Debugging is a vital skill for any programmer Fixing errors Debugging is a vital skill for any programmer It’s time for you to get a bit of practise! Click here: … or type this link: goo.gl/fY5Xm8 You will need to unzip the folder (right click -> Extract all…) and double click on FixMe.sln Download the program
Enjoy your Easter break! That’s it for this term! Enjoy your Easter break!