2 Replies - 1082 Views - Last Post: 20 March 2010 - 10:39 AM Rate Topic: -----

#1 dmonroe4919  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-March 10

Constructing Calculations

Posted 19 March 2010 - 04:11 PM

I have constructed some to code to calculate some points for me, but I keep getting these errors:
rb:5: syntax error, unexpected kEND, expecting ')'
rb:9: syntax error, unexpected kEND, expecting ')'
rb:41: syntax error, unexpected $end, expecting kEND

I have tried rearranging some things to get it to work properly but nothing has been successful. Can someone please help? Here is the code:

Shoes.app(:title => "Collinear Points", :width => 450, :height => 350) do

def calculate
math.sqrt((((@gammax.text.to_f-@alphax.text.to_f)**2)+((@gammay.text.to_f-

@alphax.text.to_f)**2)+((@gammaz.text.to_f-@alphaz.text.to_f)**2))+math.sqrt

((((@betax.text.to_f-@alphax.text.to_f)**2)+((@betay.text.to_f-@alphay.text.to_f)**2)+

((@betaz.text.to_f-@alphaz.text.to_f)**2))
end

def capture
math.sqrt((((@gammax.text.to_f-@betax.text.to_f)**2)+((@gammay.text.to_f-

@betay.text.to_f)**2)+((@gammaz.text.to_f-@betaz.text.to_f)**2))
end

stack(:width => '100%', :margin => 20) do
para('Calculate Collinear Points')
para(' x y z')


flow(:width => '100%' ) do
para('Point A: ')
@alphax = edit_line(:width => 100, height => 35) {@collinear.text = calculate}
@alphay = edit_line(:width => 100, height => 35) {@collinear.text = calculate}
@alphaz = edit_line(:width => 100, height => 35) {@collinear.text = calculate}
end
flow(:width => '100%' ) do
para('Point B: ')
@betax = edit_line(:width => 100, height => 35) {@collinear.text = calculate, capture}
@betay = edit_line(:width => 100, height => 35) {@collinear.text = calculate, capture}
@betaz = edit_line(:width => 100, height => 35) {@collinear.text = calculate, capture}
end
flow(:width => '100%' ) do
para('Point C: ')
@gammax = edit_line(:width => 100, height => 35) {@collinear.text = calculate, capture}
@gammay = edit_line(:width => 100, height => 35) {@collinear.text = calculate, capture}
@gammaz = edit_line(:width => 100, height => 35) {@collinear.text = calculate, capture}
end

caption "Collinear or Non-Collinear"
if (calculate == capture)
@collinear = para('Points are collinear')
elsif
@collinear = para('Points are non-collinear')
end
end
end
end

Is This A Good Question/Topic? 0
  • +

Replies To: Constructing Calculations

#2 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Re: Constructing Calculations

Posted 19 March 2010 - 07:16 PM

In this block:
 math.sqrt((((@gammax.text.to_f-@alphax.text.to_f)**2)+((@gammay.text.to_f-
@alphax.text.to_f)**2)+((@gammaz.text.to_f-@alphaz.text.to_f)**2))+math.sqrt
((((@betax.text.to_f-@alphax.text.to_f)**2)+((@betay.text.to_f-@alphay.text.to_f)**2)+
((@betaz.text.to_f-@alphaz.text.to_f)**2))


You are missing two closing parens. I believe they go at the very end (after **2))).
Was This Post Helpful? 0
  • +
  • -

#3 dmonroe4919  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-March 10

Re: Constructing Calculations

Posted 20 March 2010 - 10:39 AM

I fixed all of my syntax errors but now when I run the program, I get a blank box. What could be the problem?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1