
-----------------------------------
slider203
Tue Feb 16, 2010 7:53 pm

Creating a Multiplication Program
-----------------------------------
Hello I am trying to create a multiplication program where the user enters a number then is multiplied by 1 - 12
heres what I have so far


//Import the input/output library.
  import java.io.*;
  class InputPractice1
{
  public static void main (String args 

I keep getting an error that says 
2 errors found:
File: H:\ICS\nEW\InputPractice1.java  [line: 33]
Error: cannot find symbol
symbol  : variable number
location: class InputPractice1

File: H:\ICS\nEW\InputPractice1.java  [line: 33]
Error: cannot find symbol
symbol  : variable number
location: class InputPractice1

been trying but I cant get it to work. Please take a look any help is appreciated

-----------------------------------
TerranceN
Tue Feb 16, 2010 8:25 pm

RE:Creating a Multiplication Program
-----------------------------------
Where did you declare number? You need to create a variable called number and assign the integer value of name to it.

Also "throws java.io.IOException" will still cause it to crash if there is an exception.

Hope that helps.

-----------------------------------
DtY
Tue Feb 16, 2010 8:26 pm

RE:Creating a Multiplication Program
-----------------------------------
You are trying to multiply a string by a number. Imagine, what is "hello"*3? It doesn't make sense[1].

To do this, you'll have to either read as an integer (instead of a string), or convert the string to an integer after reading.

[1] Some languages will actually give you "hellohellohello" for this
