Write a RUBY program that prompts the user for the weight of
Write a RUBY program that prompts the user for the weight of the article, the zone to which it is going and whether it should go by air or it is local, and then print out the correct stamp. Test your program with the following scenario. .
1. Create a Local stamp for an article weighing 2 oz. to zone 3.
2. Create an Air Mail stamp for an article weighing 2 oz. to zone 2.
3. Create a Local stamp for an article weighing ½ oz. to zone 1.
4. Create a Local stamp for an article weighing 0.58 oz. to zone 1.
5. Create a Local stamp for an article weighing 0.56 oz. to zone 2.
6. Create an Air mail stamp for an article weighing 1.0 oz. to zone 1 All mail (Local and Air) is divided in to three zones.
If the weight of the mail is ½ ounce or less, all local mail (in all three zones) must have a rate of $0.49. For the first ½ ounce or less, for all three zones, all air mail must have a rate of $0.95. Any mail more than ½ ounce is subjected to an additional charge. SAMPLE OUTPUT:
| weight | FIRST 1/2 ounce or less | For every next 1/2 ounce or less | 
| zone | local air mail | local air mail | 
| zone 1 | 0.49 0.95 | 0.49*.50 0.95*0.50 | 
| zone 2 | 0.49 0.95 | 0.49*0.65 0.95*0.60 | 
| zone 3 | 0.49 0.95 | 0.49*0.80 0.95*0.90 | 
Solution
#!/usr/bin/ruby
 array = Array.new(10)
 puts \'Enter the weight of the article: \'
 weight = gets.chomp.to_f
 puts \'Enter the zone to which it is going: \'
 zone = gets.chomp.to_f
 puts \'Is it going by 1. Air 2. Local: \'
 medium = gets.chomp.to_i
 stampDuty = 0.0
 if medium == 1 and weight <= 0.5
 stampDuty = 0.49
 else if medum == 2 and weight <= 0.5
 stampDuty = 0.95
 else if weight > 0.5
 if medium == 1
 stampDuty = 0.49
 weight -= 0.5
 if zone == 1
 while weight > 0
 stampDuty += 0.49*0.50
 weight -= 0.5
 end
 else if zone == 2
 while weight > 0
 stampDuty += 0.49*0.65
 weight -= 0.5
 end
 else
 while weight > 0
 stampDuty += 0.49*0.80
 weight -= 0.5
 end   
 end
 else
 stampDuty = 0.95
 weight -= 0.5
 if zone == 1
 while weight > 0
 stampDuty += 0.95*0.50
 weight -= 0.5
 end
 else if zone == 2
 while weight > 0
 stampDuty += 0.95*0.60
 weight -= 0.5
 end
 else
 while weight > 0
 stampDuty += 0.95*0.90
 weight -= 0.5
 end
 end
 end
 end
 puts stampDuty


