question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :density_of_the_sun do 4 kind :numerical 5 describes "The Sun has a mass of about %{mass} and a radius of about %{radius}. %{density}, in kilograms per cubic metre?" 6 given mass: "2.0e30 kg" 7 given radius: "7.0e8 m" 8 asks density: "What is its average density" 9 end
1 require_relative "../questions/density_of_the_sun" 2 require_relative "../science/units_and_measurement/dimensions" 3 4 solve :density_of_the_sun , using: Dimensions do 5 take mass: :m , radius: :r 6 take density: :rho 7 answer find_value ( :density , figures: 2 ) 8 9 conclusion "More than water, far less than rock. The Sun is gas, but gas squeezed hard by its " \ 10 "own weight." 11 end
1 require_relative "../solutions/density_of_the_sun" 2 3 play_with :density_of_the_sun do 4 title "The Density of the Sun" 5 end