Created
May 9, 2012 19:35
-
-
Save fakefarm/2648235 to your computer and use it in GitHub Desktop.
Coding a pricelist matrix
This file contains 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 "How many shirts?" | |
quantity = gets.chomp.to_i | |
puts "how many colors?" | |
colors = gets.chomp.to_i | |
pricelist = [ | |
[1.30,1.85,2.50], # 1 - 35 pieces | |
[0.95, 1.30, 1.70,2.20,2.5 ], # 36 - 71 pieces | |
] | |
if quantity.between?(1, 35) | |
if colors == 1 | |
puts pricelist[0][0] | |
elsif colors == 2 | |
puts pricelist[0][1] | |
elsif colors == 3 | |
puts pricelist[0][2] | |
elsif colors == 4 | |
puts pricelist[0][3] | |
elsif colors == 5 | |
puts pricelist[0][4] | |
elsif colors == 6 | |
puts pricelist[0][5] | |
elsif colors == 7 | |
puts pricelist[0][6] | |
elsif colors == 8 | |
puts pricelist[0][7] | |
elsif colors == 9 | |
puts pricelist[0][8] | |
elsif colors == 10 | |
puts pricelist[0][9] | |
elsif colors == 11 | |
puts pricelist[0][10] | |
elsif colors == 12 | |
puts pricelist[0][11] | |
else | |
puts "call us" | |
end | |
elsif quantity.between?(36, 71) | |
if colors == 1 | |
puts pricelist[1][0] | |
elsif colors == 2 | |
puts pricelist[1][1] | |
elsif colors == 3 | |
puts pricelist[1][2] | |
elsif colors == 4 | |
puts pricelist[1][3] | |
elsif colors == 5 | |
puts pricelist[1][4] | |
elsif colors == 6 | |
puts pricelist[1][5] | |
elsif colors == 7 | |
puts pricelist[1][6] | |
elsif colors == 8 | |
puts pricelist[1][7] | |
elsif colors == 9 | |
puts pricelist[1][8] | |
elsif colors == 10 | |
puts pricelist[1][9] | |
elsif colors == 11 | |
puts pricelist[1][10] | |
elsif colors == 12 | |
puts pricelist[1][11] | |
else | |
puts "call us" | |
end | |
else | |
puts "call us" | |
end | |
# incorporate the screen charges | |
# incorporate blank good |
Author
fakefarm
commented
Jun 8, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment