Wednesday, July 17, 2019

Civil Status Checker Using Hashes in Ruby

Write a program uses hashes that will ask the user's name and civil status by selecting 1-Single, 2-Married, 3-Widow, 4-Divorce, and 5-Separate and then the program will display the name of the user's name in uppercase and the civil status of the user.

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



Sample Program Output


Program Listing

civil_status.rb

# civil_status.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : July 17, 2019   Tuesday   4:19 PM
# 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@gmail.com and jakerpomperada@yahoo.com

  civil_option =[1, 2, 3, 4, 5]
  status = ['Single','Married','Widow','Divorce','Separate']
  print "\n"
  print "\t===== Civil Status Checker Using Hashes ====="
  print "\n\n"
  print "\tWhat is your name  : ";
  name =gets.chomp  
  print "\n"
  print "\t1-Single, 2-Married, 3-Widow, 4-Divorce and 5-Separate\n";
  print "\n";
  print "\tGive your civil status : ";
  select = gets.to_i
  position = 0
  position = civil_option.index(select)
if position != nil then
  print "\n\n"
  print "\tHello #{name.upcase} your civil status is #{status[position]}."
else
  print "\n\n" 
  print "\tSorry #{name.upcase} your civil status is unknown."
end
print "\n\n";
print "\tEnd of Program"



No comments:

Post a Comment