---
# System prepended metadata

title: Day 3 Activities
tags: [Gemcamp]

---

# Day 3 Activities
 
 In your `gemcamp_ruby_basic` repository, please create a new folder named `conditional_statements` and solve the following problems. Ensure that your commits are meaningful and clearly describe the following problems.

 
 
1. Write a program that asks the user for a number and checks if it is positive. If the number is positive, print `The number is positive`.
 
1. Write a program that asks the user for a number and checks if it is even. If the number is even, print `The number is even`.

1. Write a program that takes two numbers and checks if they are equal. 
If they are, print `The numbers are equal`.
 
1. Write a program that asks for a person's age and checks if they are 18 or older. If they are, print `You are eligible to vote`.
 
1. Write a program that asks for a word and checks if it contains the letter `a`. 
   If it does, print `The word contains the letter 'a'`.
 
1. Write a program that asks the user for a number and checks if it is between 10 and 20 (inclusive). If it is, print `The number is between 10 and 20`.
 
1. Write a program that asks the user for two words and checks if they are the same. If the two words are the same, print `The words are identical`.

1. Write a program that asks for a number and checks if it is divisible by 5.
   If it is, print `The number is a multiple of 5`.

1. Write a program that asks the user to enter some text and checks if the text is empty. If it is, print `You entered an empty string`.
 
1. Write a program that asks for a person's age and  checks if they are a teenager (between 13 and 19). If they are, print `You are a teenager`.
 
1. Write a program that asks the user for a number and checks if it is positive or negative. If it is positive, print `The number is positive` Otherwise, print `The number is negative.`
 
1. Write a program that asks the user for a number and checks if it is even or odd. If it’s even, print `The number is even.` Otherwise, print `The number is odd.`
 
1. Write a program that takes two numbers and checks if they are equal. If they are equal, print `The numbers are equal.` Otherwise, print `The numbers are not equal.`
 
1. Write a program that asks for a person's age and checks if they are 18 or older. If they are, print `You are eligible to vote.` Otherwise, print `You are not eligible to vote.`
 
1. Write a program that asks for a word and checks if the word has more than 5 characters. If it does, print `The word is long.` Otherwise, print `The word is short.`
 
1. Write a program that asks the user for a number and checks if it is between 10 and 20 (inclusive). If it is, print `The number is within range.` Otherwise, print `The number is out of range.`
 
1. Write a program that asks the user for two words and checks if they are the same. If they are the same, print `The words are identical.` Otherwise, print `The words are different.`
 
1. Write a program that asks for a person's age and checks if they are 65 or older. If they are, print `You are a senior citizen.` Otherwise, print `You are not a senior citizen.`
 
1. Write a program that asks the user to enter some text and checks if the string is empty. If it is, print `You entered an empty string.` Otherwise, print `You entered: #{input}.`
 
1. Write a program that asks for a number and checks if it is divisible by 10. If it is, print `The number is a multiple of 10.` Otherwise, print `The number is not a multiple of 10.`

1. Write a program that asks the user for a number and checks if it is between 50 and 100 (inclusive) and if it is even. Print `The number is valid and even.` if both conditions are true, otherwise print `The number does not meet the criteria.`

1. Write a program that asks the user for their age and membership status. If the person is a member or they are older than 60, print `You are eligible for a discount.` Otherwise, print `You are not eligible for a discount.`

1. Write a program that asks for a word and checks if it contains more than 7 characters and contains the letter `e`. If both are true, print `The word is long and contains 'e'.` Otherwise, print `The word does not meet the criteria.`

1. Write a program that asks the user for their age and whether they are on the guest list. If they are older than 18 and on the guest list, print `You can enter the club.` Otherwise, print `You cannot enter.`

1. Write a program that asks for a number and checks if it is divisible by 3 and/or 5. 
   If divisible by both, print `The number is divisible by both 3 and 5.` 
   If only divisible by 3, print `The number is divisible by 3.` 
   If only divisible by 5, print `The number is divisible by 5.` 
   Otherwise, print `the number is not divisible by 3 or 5.`

1. Write a program that asks for the user’s age and whether they have passed the driving test. If they are at least 18 and have passed the test, print `You are eligible for a driver's license.` Otherwise, print `You are not eligible.`

1. Write a program that asks for a string and checks if it is empty or only contains spaces. If either condition is true, print `The string is empty or only contains spaces.` Otherwise, print `The string has valid content.`

1. Write a program that asks for a number and checks whether it is positive, negative, or zero. Print `The number is positive.` if it’s positive, `The number is negative.` if it’s negative, or `The number is zero.` if it's zero.

1. Write a program that asks for a username and password. If the username is `admin` and the password is `secret`, print `Access granted.` Otherwise, print `Access denied.`

1. Write a program that asks for a person's age and checks if they are a teenager (between 13 and 19) or an adult (20 and older). If they are a teenager, print `You are a teenager.` If they are an adult, print `You are an adult.` If they are younger than 13, print `You are a child.`

1. Write a program that loops through an array of numbers and prints each number if it is even.

1. Write a program that loops through an array of numbers and sums all the odd numbers. Print the total sum at the end.
 
1. Write a program that loops through an array of words and prints "Found the word!" if it finds the word "ruby".

1. Write a program that loops through an array of numbers and counts how many of them are positive. Print the total count at the end.

1. Write a program that loops through an array of numbers and replaces any negative numbers with 0. Print the updated array.

1. Write a program that loops through an array of names and capitalizes each name. Print the updated array of capitalized names.
 
1. Write a program that loops through an array of numbers and prints `All numbers are greater than 10` if every number is greater than 10.
 
1. Write a program that loops through two arrays and checks if corresponding elements from each array are equal. Print the index and values if they are equal.

1. Write a program that loops through an array of strings and prints only the strings that are longer than 4 characters.
 
1. Write a program that loops through an array of numbers and finds the largest number. Print the largest number at the end.


### Try to solve the following problems using the UNLESS keyword

1. Write a program that asks the user for a number and checks if it is not positive. If it is not positive, print `The number is not positive.`
 
1. Write a program that asks for a word and checks if it does not contain the letter `a`. If it doesn’t, print `The word does not contain the letter 'a'.`

1. Write a program that asks for a person's age and checks if they are not 18 or older. If they are not, print `You are not eligible to vote.`

1. Write a program that asks for a string and checks if it is not empty. If it’s not empty, print `You entered: <input>.`

1. Write a program that asks for a number and checks if it is not even. If it is not even, print `The number is odd.`

1. Write a program that asks if the user is logged in. If they are not logged in, print `You need to log in.`

1. Write a program that asks for the current temperature and checks if it is not below freezing (32°F). If it is not, print `The temperature is above freezing.`

1. Write a program that asks for a number and checks if it is not divisible by 5. If it is not, print `The number is not divisible by 5.`

1. Write a program that asks the user for a password. If the password is not `12345`, print `Access denied.`

1. Write a program that asks for a person's age and checks if they are not an adult (under 18). If they are not, print `You are not an adult.`


### Try to solve the following problems using the Case Statement keyword

1. Write a program that asks the user for a day of the week (as a number from 1 to 7). Use a case statement to print the name of the day, Example (1 = "Monday").

1. Write a program that asks for a letter grade (A, B, C, D, F). Use a case statement to print a message based on the grade, Example: ("A" = "Excellent", "B" = "Good", etc.)
 
1. Write a program that asks for a t-shirt size (S, M, L, XL). Use a case statement to print the size name, Example ("S" = "Small").
 
1. Write a program that asks for a traffic light color (red, yellow, green). Use a case statement to print the action the driver should take, Example: ("Red" = "Stop").
 
1. Write a program that asks for the name of a month. Use a case statement to print which season the month belongs to, Example: (December = "Winter").
 
1. Write a program that asks for the name of an animal. Use a case statement to check if the animal is a mammal, bird, or reptile, Example: ("dog" = "mammal", "eagle" = "bird", "snake" = "reptile").
 
1. Write a program that asks for a movie genre (comedy, drama, action, horror). Use a case statement to print a suggestion for a movie to watch in that genre.
 
1. Write a program that asks for a person’s gender (male/female) and marital status (married/single). Use a case statement to print the appropriate title, Example: (male + married = "Mr.", female + single = "Ms.").
 
1. Write a program that asks for a number. Use a case statement to print a message based on the range the number falls into, Example: (less than 10, between 10 and 20, greater than 20).
 
1. Write a program that asks for the number of sides of a shape (3, 4, 5, 6). Use a case statement to print the type of shape, Example: (3 = "Triangle", 4 = "Square", etc.).
