I'm trying to make an interactive calculator to solve the volume of a sphere. The thing is that I can't seem to make the program let the user input their own number for example, What if the user wants to the number four as the radius?
Here is what I have done:
% Here Are My Variables
var v : real
var r : real
const pi : real := 3.14159265358979323846
var choice : string
var numOfV : real
var numOfr : real
r := numOfr
v := 4/3 * pi * r ** numOfr
put "Hey! I hope I'm not bothering you but could you do me a huge favor? yes/no"
get choice
if choice="yes" then
put "Yay! Thank you soooo much! I'll see you tonight then. Don't forget to bring that big brain of yours Haha!"
else
put "Ugh! You dont have a choice! You're coming over to my house...You know...Helping me understand the homework of course!"
end if
put "Later that day"
put "Hey you made it! please come in. Alright let's begin, shall we?"
put "Ok the question say's that we need to find the volume of the sphere! but what variable do you want to use for v?"
get numOfV
put "Ok! what number do you want to use for r?"
get numOfr
put "Ok! Let's solve for for V = ", numOfV, " and for r= ", numOfr, " Alright?"
put "OKAY! The volume of the sphere with the radius of ", numOfr, " units is ",v, " cubic units"