J
Jed Kowalski
hi,
Can You tell me please why this instruction doesn't want to work
properly?
It only repeats the:
puts "Buy drink: press 1"
puts "Print money report: press 2"
puts "Print drink report: press 3"
puts "Exit: press 0"
but nothing more
while q!=0
puts "What to do?"
puts "Buy drink: press 1"
puts "Print money report: press 2"
puts "Print drink report: press 3"
puts "Exit: press 0"
q = gets
puts q
puts q
case q
when 1:
for j in 0..2
drinks[j].namea()
puts ": "+drinks[j].pricea()+" press "+j
end
g = gets
if drinks[g].czyjest() then
y=1
s=0
while y!=0
puts "Cash: ",s," What to do: \n\t\t Insert cash: 0
\n\t\t Buy drink: 1 \n\t\t Cancel: 2"
puts "Choose: "
y = gets
if y==0 then
puts "Insert coins. "
m = gets
s+=m
p.add(m)
end
if y==1 && drinks[g].givechange(s)<0 then puts "No money, insert
coins"
else
puts "change: "
p.monety(drinks,s,g)
end
if y==2 then break end
end
else puts "No such drink."
end
when 2:
p.write()
break;
when 3:
puts "You bought: "
for i in 0..2
drinks.namea()
puts ": ", drinks.bought()
end
end
end
Can You tell me please why this instruction doesn't want to work
properly?
It only repeats the:
puts "Buy drink: press 1"
puts "Print money report: press 2"
puts "Print drink report: press 3"
puts "Exit: press 0"
but nothing more
while q!=0
puts "What to do?"
puts "Buy drink: press 1"
puts "Print money report: press 2"
puts "Print drink report: press 3"
puts "Exit: press 0"
q = gets
puts q
puts q
case q
when 1:
for j in 0..2
drinks[j].namea()
puts ": "+drinks[j].pricea()+" press "+j
end
g = gets
if drinks[g].czyjest() then
y=1
s=0
while y!=0
puts "Cash: ",s," What to do: \n\t\t Insert cash: 0
\n\t\t Buy drink: 1 \n\t\t Cancel: 2"
puts "Choose: "
y = gets
if y==0 then
puts "Insert coins. "
m = gets
s+=m
p.add(m)
end
if y==1 && drinks[g].givechange(s)<0 then puts "No money, insert
coins"
else
puts "change: "
p.monety(drinks,s,g)
end
if y==2 then break end
end
else puts "No such drink."
end
when 2:
p.write()
break;
when 3:
puts "You bought: "
for i in 0..2
drinks.namea()
puts ": ", drinks.bought()
end
end
end