PDA

View Full Version : Question on Roman Numerals

TheDarkWolf
03-09-2012, 04:48 AM
I am doing a project which entitles my character to say a number as a roman numeral. Can someone explain to me on how i can accomplish this?

TheDarkWolf
03-09-2012, 04:49 AM
And by meaning not the say command but how can i get my character to say a number as a roman numeral

sfunk
03-09-2012, 09:18 AM
so i'm guessing you mean as example have 1=I 2=II and so forth? if so, you need to explain more on how you need to accomplish this goal, such as, are we having a user input a value which then converts it to a Roman numeral? or are we just using pre-determined numbers?

if you are using pre-determined numbers, that would be easy, just have an object say 1=I,2=II etc.

However, I'm assuming you want user input, this is kinda tricky as in you would have to figure out a limit of value you want the user to be able to enter, The reason I say this is because the only method I can think of to do this is using If/else statements.

so to say
if x==y
then object blah blah blah
else
do nothing

Which this is saying if x (your variable) is equaled to value(normally user input) then the alice world will do whatever action you tell it to do.
you would just have to make a bunch of these and then have the user put their input, then have the world check their input with your statements, and have whatever action it is told to do be bone.

zilants
03-29-2012, 05:04 PM
How would i say make a program that

asks me for a number input

and i type in say a digit 1-5

and a object tells me it back in roman numerals?

ex 1=i 2=ii etc

SnowWolf
02-18-2014, 03:29 PM
so i'm guessing you mean as example have 1=I 2=II and so forth? if so, you need to explain more on how you need to accomplish this goal, such as, are we having a user input a value which then converts it to a Roman numeral? or are we just using pre-determined numbers?

if you are using pre-determined numbers, that would be easy, just have an object say 1=I,2=II etc.

However, I'm assuming you want user input, this is kinda tricky as in you would have to figure out a limit of value you want the user to be able to enter, The reason I say this is because the only method I can think of to do this is using If/else statements.

so to say
if x==y
then object blah blah blah
else
do nothing

Which this is saying if x (your variable) is equaled to value(normally user input) then the alice world will do whatever action you tell it to do.
you would just have to make a bunch of these and then have the user put their input, then have the world check their input with your statements, and have whatever action it is told to do be bone.

I'm actually having the same issue as this poster and thought maybe I could get a bit of direction. This is the actual text of the tutorial from the Alice book.

"Create an interactive world that asks the user to enter a number that is at least 1 but not greater that 10. A character of your choice should translate the number to Roman numerals, and say the roman numerals in a speech bubble. If the user enters a number outside the range of 1 through 10, the character should say that is an invalid number was entered."

The first and third part I can do fine. I declare the variable, then set the variable to "ask the user for a number", I create an if/else statement to compare the variable to a number less than or equal to 10, and then I add what would be said if the number falls inside or outside of the range. My issue is I have no clue on when a user inputs say a 5 to get it to appear as the roman numeral V when the text bubble pops up. Sorry to bump an older topic but I thought it would make more sense than creating a new one.

MrMoke
02-18-2014, 04:16 PM
Are you by any chance studying how arrays work? sounds like a perfect opportunity to use one, and makes for a really short program once you get it set up.

SnowWolf
02-18-2014, 04:48 PM
Are you by any chance studying how arrays work? sounds like a perfect opportunity to use one, and makes for a really short program once you get it set up.

We aren't even close to that, we are on if/else statements currently.

MrMoke
02-18-2014, 07:12 PM
The character says "Duh".
The character says "I".

Etc., etc., etc.

empowermenttech
02-28-2014, 05:17 AM
Nice question and very good answers. I got also my answer. Thanks

MrMoke
03-04-2014, 10:57 AM
That's good.

MrMoke
03-07-2014, 03:29 PM
OK- I got Bored! So I tried to do this in Alice3 using TextModels.

As before, the Alice3 file extension isn't valid for uploading, so it's zipped.

I'd have gone to 100, but it would have given me a Huge headache :o