The merge sort algorithm is one of the fastest algorithms that exists for sorting arrays. Consider the following algorithm and example for sorting the array that contains (3, 4, 1, 5, 2, 7, 6}. Despite its complicated algorithm, merge sort is the fastest algorithm at O(n log2n) compared to selection, insertion and bubble sorts at O(n2).
For this assignment, you will create a short video that demonstrates how one of the sorting algorithm works using a regular set of playing cards. In the video, you must (1) identify which sorting algorithm that you have chosen, (2) explain what the purpose is and how the algorithm works (in subtitles), (3) implement the algorithm on some randomly-shuffled cards, and (4) count the number of steps to sort the cards. To improve your communication with your audience, you may want to explain what is going on step by step. Continue reading
Simplified Rules of Sic-Bo:
- Player enters the table with money in his/her wallet.
- Player can bet any whole-number amount he/she chooses less than or equal to the amount they have in their wallet. (Minimum $1)
- Player places a bet on either BIG or SMALL based on the sum of three dice.
- SMALL: 4 to 10
- BIG: 11 to 17.
- Dealer randomly rolls three dice (each dice is numbered 1 to 6) after bet is placed.
- Dealer wins if the player misplaces the bet OR if the dealer rolls a triple (e.g. 1-1-1, 2-2-2, etc.). For example, if the player bets $5 and loses, then the player loses $5 from his wallet.
- Player wins a 2:1 payout if he/she guesses correctly. For example, if the player bets $5 and wins, then the player gains $5 from his wallet.
- Game is over when either player cashes out or has no more money.
The current game allows the cat the move left and right, jump when it’s on a platform, and drop when nothing is underneath it.
Task: Modify the game with the following things:
- Include an intro screen with three stages and winning screen. The intro screen should transition into the first stage after 2-5 seconds or after start button is pressed.
- At each stage, there is a flag. If the cat touches the flag, it advances to the next stage. The cat advances to winning screen after it touches third-stage flag.
- The cat start each stage at a fixed position.
- Include at least one of the following: (1) lava, (2) spikes, or (3) enemy — with a natural consequence.
- Contest Period: Dec. 10 to Jan. 8 (Trial)
- Initial Cash Balance: $10,000.00 CAD
- Securities: Mutual Funds, Stocks and ETFs on TSX, NYSE and NASDAQ
Part A: Killing Us Softly 3
- Watch the video clip of Jean Kilborne’s Killing Us Softly 3: Advertising’s Image of Women.
- Continue reading
In an earlier lesson, the class created a form called Math Operations in which it has two text fields for user input and four buttons for the four basic arithmetic operations. The class then typed in code for the “Add” button in which it calculated the sum of two numbers in the text fields but crashed when one of its input is numeric. This issue was addressed in the String Operations example in which the class learned how to check if the input in the text fields are numeric and how to combine two or more strings. These examples can be found on the school network drive under S:\Handout\Programming 11-12.
Note: You must copy the folders onto your desktop or your storage device. You will not be able to save and run from the read-only network drive.
You will modify the Math Operations example that meets the following criteria
- The results can be decimals. For example, if 12.1 and 23.4 are entered into the text fields, the result is 35.5.
- The program adds, subtracts, multiplies and divides numbers. It then displays the result in a MsgBox.
- The text in the MsgBox displays a sentence. For example, if 12 and 13 are entered, it displays “The sum is 25.” rather than just “25”. To do this, review how to join strings in the the String Operations example.
- If one of the inputs in non-numeric (i.e. blank or text), then the MsgBox displays “Enter numbers only.”. To do this, review the IsNumeric function in the String Operations example.
- The text in the MsgBox displays “Unable to divide.” if the second number is zero when dividing. To do this, the input has to be a number and then check if it is zero. There are two ways to check:
If (num2 <> 0) Then
If (num2 = 0) Then
When complete, zip the entire folder in Projects and then upload the file onto the shared Google Drive folder.
Evaluation: Total 10 marks
- Proper comments and well-labeled names (2 marks)
- Add, subtract, multiply and divide (4 marks)
- Provides correct answers.
- Includes decimal inputs and outputs.
- Exceptions (2 marks)
- Division by 0
- Visual Design (2 marks)
- Displays “The result is ___.” with a period.
- No spelling, grammar or punctuation errors in MsgBox.
- Visually nice and easy to use.
- Take time to edit the “Add” button properly so that it displays the result in a sentence and handles non-numeric inputs properly. After this is done, copy/paste and modify the other three arithmetic operations.
- To display a number with a string in a message box, you need to type:
MsgBox("The sum is " + sum.ToString())
- To check if your text fields are numeric, you need to type:
' Create variables
Dim num1 As Decimal
If (IsNumeric(Input1.Text) and IsNumeric(Input2.Text)) Then
' Store into variables
num1 = Input1.Text
' Calculate and display result
' Display error message
- Handle the “division by zero” exception last. Hint: Both inputs must be numbers before you can check if the second input is zero.
The article Top Five Appeals That Advertisers Use to Sell a Product describes five techniques how advertisers appeal to consumers on TV commercials. Working either in pairs or trios, you will find different YouTube videos that use these types of advertising appeals. Continue reading