Write a recursive method that parses a positive binary number as a string into a decimal integer. //Assume the input is always digit only. //If the input is not a binary number, return the same number...


Write a recursive method that parses a positive binary number as a string into a decimal integer.


//Assume the input is always digit only. //If the input is not a binary number, return the same number in the integer format Sample Input1


//A binary input 11 Sample Output1 3 Sample Input2 //Not a binary input 00112 Sample Output2 112


import java.util.*;
import java.lang.*;
import java.io.*;


class BinaryToDecimal{


// You can add more methods




public static int binaryToDecimal(String binaryString){
//write your code here


}
}
class DriverMain{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
System.out.print(BinaryToDecimal.binaryToDecimal(input.nextLine()));
}
}



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here