Tuesday, May 21, 2019

Money Bill Checker in Ruby

Here is a copy that I converted from C into Ruby I called this program money bill checker. Write and Design a program that will ask the user to give an amount and then the program will check and determine the money bill denomination based on the amount given by the user. The money bill denomination to be used in the program will be 500,100,50,20,10,5,2 and 1 bills.

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

# bill.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : May 21, 2019   Wednesday
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com
puts "\n\n"
print "\tMoney Bill Checker";
puts "\n\n"
print "\tEnter amount:   ";
amount = gets;
amount = amount.to_i;
if(amount >= 500)
        note500 = amount/500;
        amount -= note500 * 500;
else
  note500 = 0;
end   
  
if(amount >= 100)
        note100 = amount/100;
        amount -= note100 * 100;
else
  note100 = 0;
 end
    
if(amount >= 50)
     note50 = amount/50;
     amount -= note50 * 50;
else
  note50 = 0;       
end

if(amount >= 20)
     note20 = amount/20;
     amount -= note20 * 20;
else 
  note20 = 0;  
end
   
if(amount >= 10)
       note10 = amount/10;
       amount -= note10 * 10;
else 
   note10 = 0;    
end

if(amount >= 5)
     note5 = amount/5;
     amount -= note5 * 5;
else
   note5 = 0;     
end

if(amount >= 2)
    note2 = amount /2;
    amount -= note2 * 2;
else
  note2 = 0;    
end
   
if(amount >= 1)
     note1 = amount;
else
  note1 = 0;     
end    
   
print("\n\n");
print("\t===== DISPLAY RESULT =====");
print("\n\n");
print("\tTotal number of notes = \n");
print("\n\n");
print("\t500 =  #{note500}\n");
print("\t100 =  #{note100}\n");
print("\t50  =  #{note50}\n");
print("\t20  =  #{note20}\n");
print("\t10  =  #{note10}\n");
print("\t5   =  #{note5}\n");
print("\t2   =  #{note2}\n");
print("\t1   =  #{note1}\n");
print "\n\n";
print "\tEND OF PROGRAM";
print "\n\n";




No comments:

Post a Comment