Question
Write a class potentially representing a String of binary digits (0s and 1s). Your constructor should take a String as its only parameter (that String
Write a class potentially representing a String of binary digits (0s and 1s). Your constructor should take a String as its only parameter (that String may contain only 0s and 1s, or it may not). Write a recursive method that checks whether that String contains 0s and 1s only. Write another recursive method that converts that String to its decimal equivalent. Your method should be different from the one in Exercise 48: it should take two parameters, the String representing the binary number, and an int representing an exponent. Your program should include a client class to test your class.
Exercise 48
Write a class with just one instance variable, a String representing a binary number. Write a recursive method taking only one parameter that converts that binary number to its decimal equivalent. Your program should include a client class to test your class.
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