0

Hi,
I'm trying to create an array for converting Octal number from input to Binary later...print out for table look-up. Please help!

import java.util.*; // Scanner class
public class check1
{

	public static void main(String [] args)
	{

		int i;
		String biArray[]={"000", "001", "010", "011", "100", "101", "110", "111"};
		
		for(i=0; i<biArray.length; i++)
		{
			Scanner input= new Scanner(System.in);
			System.out.println("Enter the Octal number: ");
			int OctNum=input.nextInt();
			
			biArray[i]= Interger.parseInt(OctNum);
		}
		for(i=0; i<biArray.length; i++)
			System.out.println("Octal number of "+i+"is "+biArray[i]+"in binary");
	}

}

After compiled , this is what I have
check1.java:17: cannot find symbol
symbol : variable Interger
location: class check1
biArray= Interger.parseInt(OctNum);
^
1 error

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by JamesCherrill
0

Opps...
So I fixed it.
Still have this problem in the same line.

symbol : method parseInt(int)
location: class java.lang.Integer
biArray= Integer.parseInt(OctNum);
^
1 error


Do I use it right for the scanner class. And if not, what is your suggestion?

Edited by tracydo: n/a

0

Think about it...
what kind of variable does parseInt return?
what kind of variable is biArray?

ps when you have an error post the full text of the error message.

Edited by JamesCherrill: n/a

0

They're both integers.
How do I convert the input Octal to Binary by pulling out from the array biArray[]={"000", "001", "010", "011", "100", "101", "110", "111"}; ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.