JumpStart Live (JSL)
- Review your Student Account Generator Part 1 solution and be prepared to talk with others about your code.
- Review the Array notes from JumpStart.
- Watch the Day 5 Videos (~20 minutes).
- Review lesson notes for Day 5.
- Complete the exercises and be prepared to discuss it with others in class.
- Share what you learned from our last two sessions about loops
- Walk your partner though your Student Account Generator Part 1 code focusing on using programming vocabulary (e.g, arrays, index, value, blocks, loops, iterator, variable assignment)
In one Ruby file, write code to solve the problems below. Your code should print out each problem statement, followed by the described output.
- Create an array to store 5 names. Have the user enter in the 5 names and then print out the 5 names in all UPPERCASE all on the same line. Note that the user may not enter all the names in uppercase.
- Create an array to store 3 boolean values entered in by the user. Print out YES if all the values are true and NO if at least one value is false. Hint: Prompt the user to enter
true
orfalse
, and accept those values usinggets
. Sincegets
will give us back a string (instead of the boolean values we want) use if statements to convert those strings to boolean values. - Create an array to store the following words: firetruck, fire drill, fire hydrant, firefighter, fireproof, fire station, fire hose. Then write code that uses the array to print out
truck, drill, hydrant, fighter, proof, station, hose
without modifying the array. - Create an array to store the amount of money spent on 4 people during the Holidays. Have the user enter in the amount spent on each person. Print the total spent on all the people. Total money spent should be displayed with a dollar sign, decimal point, and only 2 digits after the decimal.
- Create an array to store 5 random numbers (between 1 and 10, including both 1 and 10) generated by the computer. Print out the square of each of the elements in the array.
- Create an array to store 5000 decimal numbers. Randomly generate numbers from between 0 – 1 (including 0, but not including 1) to fill the array. Calculate and print the mean of all the elements in the array.
In one Ruby file, write code to solve the problems below. Your code should print out each problem statement, followed by the described output.
- Create an array of people that are invited to a party. Allow the user to ask if a certain person is invited to the party. If the person is on the invitation list respond INVITED otherwise respond NOT INVITED.
- Have the user enter in a sentence. Then, using an array, store the frequency of each letter of the alphabet from the sentence. Print out the frequency of each letter. Do not count uppercase and lowercase letters differently.
- Create an array of size 8. Fill the array randomly with 0’s and 1’s. Print out the array so that it appears as a binary number. Calculate and print out the decimal value of that binary number.
- Why are arrays useful in programming?
- What topics are you still struggling with?
- What did you especially enjoy about today's class?
- What can be improved for future classes?
- Revise your code for exercises for the day based on discussions in class. Share the gist with the instructor(s).
- Review your Student Account Generator Part 2 solution and be prepared to talk with others about your code.
- Review the Hash notes from JumpStart.
- Watch the Day 6 Videos (~16 minutes).
- Review lesson notes for Day 6.
- Complete the Day 6 exercise and be prepared to discuss it with others in class.