Showing posts with label Legal Age Program Using Ternary Operator in Ruby. Show all posts
Showing posts with label Legal Age Program Using Ternary Operator in Ruby. Show all posts

Sunday, June 30, 2019

Legal Age Program Using Ternary Operator in Ruby

Design a program that will ask the user to give their age the program check if the age of the user is still a minor or already an adult using the ternary operator. The legal age here in the Philippines is 18 years old and above.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

# legal.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 7, 2019   Friday  4:51 AM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Website  : http://www.jakerpomperada.com
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com

puts "\n\n"
print "\tLegal Age Program Using Ternary Operator";
puts "\n\n"
print "\tTell me your name? ";
name = gets.chomp;
print "\tWhat is your age? ";
age = gets.chomp;
age = age.to_i;
puts("\n");
print "\t===== DISPLAY RESULT ====="
print "\n\n";

display_result = (age >= 18) ? "You are already an ADULT." : "You are still a MINOR." ; 

print("\tHello #{name.upcase}.\n");
print("\tAt the age of #{age} years old.\n\n")
print("\t#{display_result}");
print("\n\n");
print "\tEND OF PROGRAM";
print "\n\n";