This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "simple calculator" | |
25.times { print "-" } | |
puts | |
puts "enter first number" | |
num_1 = gets.chomp | |
puts "enter the second number" | |
num_2 = gets.chomp | |
puts "what do you want to do" | |
puts "(M)ultiple, (D)ivide, (S)ubtraction, (A)ddition, (R)emainder" | |
type = gets.chomp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "what is your name?" | |
name = gets.chomp | |
if name == "Zachary" | |
puts "Welcome to the program future ruby programmer, #{name}" | |
elsif name == "Melisa" | |
puts "welcome to the program, Melisa" | |
else | |
puts "welcome to the program, #{name}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# puts "what is your first name" | |
# first_name = gets.chomp | |
# puts "what is your first name" | |
# last_name = gets.chomp | |
# puts "Your full name is #{first_name} #{last_name}" | |
# full_name = first_name + " " + last_name | |
# puts "Your full name reversed is #{first_name.reverse!} #{last_name.reverse!}" | |
# puts "your name has #{full_name.length - 1} characters in it" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multiply(num_1, num_2) | |
num_1.to_f * num_2.to_f | |
end | |
def divide(num_1,num_2) | |
num_1.to_f / num_2.to_f | |
end | |
def add(num_1, num_2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "what is your first name" | |
first_name = gets.chomp | |
puts "what is your first name" | |
last_name = gets.chomp | |
puts "Your full name is #{first_name} #{last_name}" | |
full_name = first_name + last_name | |
puts "Your full name reversed is #{first_name.reverse!} #{last_name.reverse!}" | |
puts "your name has #{full_name.length} characters in it" |