Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please help me with this i don't understand what they want me to do here. when I run the program it say error reached
please help me with this i don't understand what they want me to do here. when I run the program it say " error reached end of file while parsing }" i don't understand. please
Help/FAQ Annicette Ndjonti Write a program that takes in a positive integer as input, and outputs a string of 1's and O's representing the integer in binary. For an integer x, the algorithm is As long as x is greater than 0 Output x 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the O's and I's in reverse order. You will need to write a second function to reverse the string Ex: If the input is 6 the output is: 110 Your program must define and call the following two methods. The method integer ToReverseBinary should return a string of 's and O's representing the integer in binary (in reverse). The method reverseString(should return a string representing the input string in reverse public static String integerToReverseBinary(int integerValue) public static String reverseString(String inputString) do ENG 724 PM INTL 1/24/2021 all.java 1 import java.util.Scanner; 2 3 public class LabProgram { Load default template public class main 7 8 9 10 11 12 13 14 public static void main(String[] args) { Scanner scnr= new Scanner(System.in); System.out.print("Enter a integer : "); int a = in.nextInt(); String ans = ""; while(a>){ if(a%2==1) ans+='1'; else ans +=''; a=a/2; StringBuffer result = new StringBuffer (ans); result.reverse(); System.out.print(" nConverted bimary number : ) 17 18 19 20 21 + result); Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. rogram innut (ontional)
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