dofile("./System/config.lua")
red=Color.new(255,0,0)
green=Color.new(0,255,0)

radius=0
height=0

select1=red
select2=red
select=1
oldpad = Controls.read()
while true do
screen:clear()
pad = Controls.read()
if pad:start() then
	dofile("./System/formula.lua")
	break;
end

screen:print(20,100,"Surface Area: " .. ((2*pi*radius)*height)+((pi*radius)^2) .. "    Volume: " .. (pi*radius^2)*height,green)
screen:print(100,120,"radius: " .. radius, select1)
screen:print(100,140,"height: " .. height, select2)

if select==1 then
	select1=green
	else
	select1=red
end
if select==2 then
	select2=green
	else
	select2=red
end
if pad:left() and pad:left() ~= oldpad:left() and select==1 then
	radius=radius-1
end
if pad:right() and pad:right() ~= oldpad:right() and select==1 then
	radius=radius+1
end

if pad:left() and pad:left() ~= oldpad:left() and select==2 then
	height=height-1
end
if pad:right() and pad:right() ~= oldpad:right() and select==2 then
	height=height+1
end


if pad:up() and pad:up() ~= oldpad:up() then
	select=select-1
end
if pad:down() and pad:down() ~= oldpad:down() then
	select=select+1
end

if select>2 then
	select=1
end
if select<1 then
	select=2
end
screen.waitVblankStart()
screen.flip()
oldpad=pad
end