well guys pretty much I need to turn in an assignment next week that consists of a user inputting a number, and I spell it out for them. for example:
Please enter a number: 452 (say user inputs 452)
You entered: Four hundred fifty two.
my teacher explained to break it down, for example there could be 9 hundreds (one hundred, two hundred, three hundred, etc upto nine hundred)
same thing goes for tens, and ones.
This is what I got in my code so far, but I know i'm doing something wrong.
how can i figure out how to to configure whats in the "tens" position. for example, in the number above, the "5" position.
Please enter a number: 452 (say user inputs 452)
You entered: Four hundred fifty two.
my teacher explained to break it down, for example there could be 9 hundreds (one hundred, two hundred, three hundred, etc upto nine hundred)
same thing goes for tens, and ones.
This is what I got in my code so far, but I know i'm doing something wrong.
Code:
int hundreds;
int tens;
int ones;
scanner input = new scanner (system.in);
s.o.p("please enter a number:");
hundreds = input.nextInt();
if (1 == hundreds)
{
system.out.println("One-Hundred);
}
else if (2 ==hundreds)
{
s.o.p.("Two-hundred);
}
how can i figure out how to to configure whats in the "tens" position. for example, in the number above, the "5" position.