Jumpstart Live (JSL)
- Review your Madlibs solution and be prepared to talk with others about your code
- Have a big picture idea of your own work flow and how to improve it
- Understand and be able to use Ruby style practices
- Walk your partner though your MadLibs code focusing on using programming vocabulary (e.g, variables, assignment, strings, input, output, string interpolation, string concatenation)
-
Discuss bad style Madlibs example
-
How would you modify the code below to improve the code style and readability?
foods = ["shrimp", "cauliflower", "salmon", "garlic", "oysters",
"salami", "tomatoes", "okra", "zucchini", "avocado"]
print "\nHow many foods would you like to see? I suggest 10, but it's up to you. "
items=gets.chomp.to_i
if items >10
puts "Best I can do is 10. Let's do 10."
items=10
elsif items >=1 && items<= 10
puts "Ok! Let's do " + items + "."
else
puts "We'll just pretend you said 10."
items = 10
end
puts "...Your Fancy Random Menu..."
items.times do |i|
y = foods[rand(0...(foods.length))]
puts i.to_s+": "+y
end
-
Revisit your MadLibs code, and update your code to improve its style
-
Bio Program
- Create a program that accepts input from the user and outputs a bio with that information
- Use up to five different attributes about the person to populate the bio
- Output should consist of a paragraph of output created from the users input
####Use Case Input
Name: Viola Davis
Birthday: August 11th, 1980
Occupation: Actress
Output
Viola Davis is an actress who is 50 years old.
Her birthday is on August 11th.
She is a(n) actress.
####Optional Challenge Use the attributes provided to do some calculations to make your bio a bit more interesting.
Output
Viola Davis is an actress who is 50 years old.
Her birthday is 34 days from today, on August 11th.
She is a(n) actress.
- What new things did you learn today?
- What topics are you still struggling with?
- What did you especially enjoy about today's class?
- What can be improved for future classes?
- Review your Candy Machine solution and be prepared to talk with others about your code
- Review the Conditional notes from Jumpstart
- Review the Operators notes from Jumpstart