
December 8th, 2009, 10:50 AM
|
|
|
Code:
class Pizza
def initialize()
end #def initialize
def list()
print <<EOF
1) Southwestern Large 17.95 17) House Mized Green Large 3.50
2) Southwestern Small 10.95 18) House Mixed Green Small 1.95
3) Pizza Margherite Large 10.95 19) Mozzarella Caprese 7.95
4) Pizza Margherite Small 8.95
5) Pepperoni Classico Large 17.95 Starters
6) Pepperoni Classico Small 10.95 20) Antipasto Platter 7.95
7) Hawaiian Pizza Large 17.95 21) Cheese Bread 5.95
8) Hawaiian Pizza Small 10.95 22) Breadsticks and Dip 2.50
9) Greek Pizza Large 17.95
10) Greek Pizza Small 10.95 Pasta
11) Pesto Eggplant Large 17.95 23) Fusilli Lunghi 13.25
12) Pesto Eggplant Small 10.95 24) Fettuccine Alfredo 14.75
13) Wild Mushrooms and Artichokes Large 17.95 25) Lasagna Fresco 12.75
14) Wild Mushrooms and Artichokes Small 10.95
Drinks Desert
15) Sodas with Refils 1.75 26) Soumoni 2.95
16) Cofee and Tea 1.25 27) Chocolate Lava Cake 5.00
28) Finished Ordering
EOF
end
def vote
@total=0
list
STDOUT.print "choose"
STDOUT.flush
while guess = STDIN.gets
list
STDOUT.print "choose"
STDOUT.flush
guess.chop!
STDOUT.print "> #{guess} <\n"
if guess == 28.to_s
exit()
end #if
@total+=case guess.to_i
when 16
1.25
when 15
1.75
when 18
1.95
when 22
2.50
when 26
2.95
when 17
3.50
when 27
5.00
when 21
5.95
when 19,20
7.95
when 4
8.95
when 2,3,6,8,10,12,14
10.95
when 25
12.75
when 23
13.95
when 24
14.75
when 1,5,7,11,13
17.95
else
arrPrice[2]
end
STDOUT.print "TOTAL : #{@total}\n"
STDOUT.flush
end #while
end #def vote
end #class Pizza
t=Pizza.new
t.vote
__________________
Helmut Hagemann Germany
fallen to the bottom of the facts?
I reach my hand and we go together
wer lesen und google kann ist klar im Vorteil
who read and google is able is clear in the advantage
|