## Steps for success!

1. Gather requirements

2. Break down problem

3. Write pseudocode

4. Code a solution

5. Test the solution

6. Consider changes

## Gather Requirements

• Asking too many questions is better than too few
• Establish what your input and output is supposed to be
• Find edge cases
• Write out requirements
• Establish programming language and expected structure
• Run once "root" code
• Function

The goal is the clarify the problem to the point that there are no more questions.

## Break Down the Problem

• Restate the key points

• Establish the priorities of the problems

## Pseudocode

• Don’t write out any code or syntax
• Focus on structure
• Just use plain old English, explain it to your Grandma.

##### Example:
Enter Value
If Value greater than 10
Log "Your number is greater than 10"
If Value less than 10
Log "Your number is less than 10"


## Write a Solution

• Write code! Finally!!!
• THINK OUT LOUD
• Mistakes are okay!
• Syntax errors are NOT the end of the world!
• Be sure to write neatly so your code can be read

If whiteboarding digitally, you should be able to drop code in a Chrome developer console and execute.

## Test

• Walk through the steps of your code verbally, OUT LOUD.
• Assign values your variables. Take us on an input’s journey!
• Test edge cases

## Consider changes

• Review and fix any bugs

• Discuss ways to improve

## Rules/Expectations

• Do NOT search for the solution for your question.
• You may use the curriculum or MDN as a reference for JavaScript.
• A team member should present one section:
• Requirements clarification & questions asked
• Break down the problem
• Present the pseudocode
• Present the code
• Run through/Test the code
• The entire class will discuss improvements & enhancements.

## Question 1

Write a JavaScript function that takes in two integers and returns their sum, unless the two integers are equal. If the two integers are equal, then return three times their sum.

Examples:

sum2Integers(10, 20) // --> 30
sum2Integers(10, 10) // --> 60

## Question 2

Write a JavaScript function that takes in integers and returns the integer with the highest value.

(Do NOT use Math.max()!!!)

Example:

findHighest(5, 8, 1) // --> 8
findHighest([4, 1, -3]) // --> 4

Take note of the argument data type options.

## Question 3

Write a function that generates a random number between 0-10.

If the number is greater than 5, log “{number} is greater than five!”.

If it is less than 5, log “{number} is less than five!”

## Question 4

Write a function that counts the number of vowels in a string.

The vowels are "a", "e", "i", "o" & "u"

Examples:

countVowels('hello') // --> 2
countVowels('why') // --> 0

## Question 5

Write a function that determines if a string is a palindrome.

A palindrome is a string that is the same forward and backwards.

Examples:

isPalindrome('racecar') // --> true
isPalindrome('table') // --> false