Question
IN JAVA: Write a recursive method that converts a positive decimal number to into a binary number as a string. The method header is: public
IN JAVA:
Write a recursive method that converts a positive decimal number to into a binary number as a string.
The method header is:
public static String decimalToBinary(int value)
Input
2
Output
10
Note: Print nothing "", if value is negative or zero.
Here is the given code with the Driver Class. PLEASE DO NOT MODIFY THE CODE!
import java.util.*;
import java.lang.*;
import java.io.*;
class HW5_P3{
public static String decimalToBinary(int value){
}
}
class DriverMain{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
System.out.print(HW5_P3.decimalToBinary(input.nextInt()));
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started