ok figured something out!!
Ok so i got am little bit further. now there is only 1 error message. Any ideas how i would fix it?
Here is the code:
Code:
import java.util.Scanner;
public class DanielsonErikA3Q1{
private static int currDigit;
private static int base;
public static void main(String[] args) {
int base;
int binaryNumber;
Scanner kbd = new Scanner(System.in);
System.out.print("Enter a base.");
base = kbd.nextInt();
System.out.println(base, binaryNumber);
}
public static int getNumberInBase( Scanner scanner, int binaryNumber) {
// get input from the user.
Scanner kbd = new Scanner(System.in);
System.out.print("Enter a binary number:");
binaryNumber = kbd.nextInt();
return binaryNumber;
}
public static int convertToDecimal(int number, int base, int binaryNumber, int copyOfBinNum, int currPower, int decimalNumber) {
// keep looping until -1 is encountered.
while (binaryNumber != -1) {
// reset values to 0, use copyOfBinNum for calculations.
decimalNumber = 0;
currPower = 0;
copyOfBinNum = binaryNumber;
}
// keep looping until all digits of copyOfBinNum are removed.
while (copyOfBinNum > 0) {
// get last digit and strip it off copyOfBinNum
currDigit = (int) copyOfBinNum % 10;
copyOfBinNum /= 10;
// add to the running total if the digit is one
if (currDigit < 10) {
decimalNumber += Math.pow(base,currPower);
return decimalNumber;
}
// increment the power of two for next loop.
currPower++;
}
return decimalNumber;
}
public static void printResults(int number, int base, int result) {
System.out.println("you input the number " + number + " in the base " + base + ". This number as a power of 10 is " + result + ".");
}
}
Here is the error message:
C:\Users\chelsea\Downloads\DanielsonErikA3Q1.java: 20: cannot find symbol
symbol : method println(int,int)
location: class java.io.PrintStream
System.out.println(base, binaryNumber);
^
1 error
Tool completed with exit code 1