subject
Engineering, 13.09.2019 01:10 Benysod402

Write a java class named numberconverter that provides methods to accept strings of binary or octal numbers and converts them to the decimal equivalent string. the class should provide the methods binaryconverter and octalconverter.
the method binaryconverter parses an input string of a binary number and converts it to a string representation of the decimal equivalent.
the method octalconverter parses an input string of an octal number and converts it to the decimal equivalent string.
in the implementation of each method, include an exception handler to throw an exception if the input string is not in the proper format for the appropriate number in java. if the number is correctly formatted, return the string representation of the decimal conversion, otherwise return the message the exception handler generates.
ensure that the input numbers only include the digits appropriate for the base.
the exceptions your methods create must keep track of the first illegal character that occurred in the string and report its position and the character itself. include an appropriate text message indicating why the exception was thrown.
in java, binary numbers begin with a 0, are followed by an upper or lower case β€˜b’ and only consist of the digits 0 and 1.
octal numbers begin with a 0 and only consists of the digits 0 through 7.

ansver
Answers: 1

Another question on Engineering

question
Engineering, 03.07.2019 15:10
Heat is added to a piston-cylinder device filled with 2 kg of air to raise its temperature 400 c from an initial temperature of t1 27 cand pressure of pi 1 mpa. the process is isobaric process. find a)-the final pressure p2 b)-the heat transfer to the air.
Answers: 1
question
Engineering, 04.07.2019 08:10
Which of the following is an easy way to remember the modified β€œx” tire rotation? a. nondrive wheels straight, cross the drive wheels b. drive wheels straight, cross the nondrive wheels c. drive wheels crossed, nondrive wheels straight d. drive wheels crossed, nondrive wheels crossed
Answers: 1
question
Engineering, 04.07.2019 18:10
The filament of an incandescent lamp has a temperature of 2000k. calculate the fraction of radiation emitted in the visible light band if the filament is approximated as blackbody
Answers: 2
question
Engineering, 04.07.2019 18:10
Which one from below is not one of the reasons of planning failures? (clo3) a)-planner is careless. b-planner spend less time in the field but more time on the desk c)-planner is not qualified d)-planner does not have sufficient time to properly plan
Answers: 3
You know the right answer?
Write a java class named numberconverter that provides methods to accept strings of binary or octal...
Questions
question
History, 10.11.2019 05:31
question
Advanced Placement (AP), 10.11.2019 05:31
question
Geography, 10.11.2019 05:31