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 14:10
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
question
Engineering, 04.07.2019 18:10
Asingle-geared blanking press has a stroke of 200 mm and a rated capacity of 320 kn. a cam driven ram is assumed to be capable of delivering the full press load at constant force during the last 15 percent of a constant-velocity stroke. the camshaft has an average speed of 90 rev/min and is geared to the flywheel shaft at a 6: 1 ratio. the total work done is to include an allowance of 16 percent for friction a) estimate the maximum energy fluctuation b) find the rim weight for an effective diameter of 1.2 m and a coefficient of speed fluctuation of 0.10
Answers: 1
question
Engineering, 04.07.2019 18:10
Afour cylinder four-stroke in-line engine has a stroke of 160mm, connecting rod length of 150mm, a reciprocating mass of 3kg and its firing order is 1-3-4-2. the spacing between cylinders is 100mm. i. show that the engine is in balance with regard to the primary inertia forces and primary 3. a and secondary inertia couples. li determine the out of balance secondary inertia force ii. propose ways of balancing this out of balance force and discuss the challenges that will arise
Answers: 3
question
Engineering, 04.07.2019 18:10
Burgers vector is generally parallel to the dislocation line. a)-true b)-false
Answers: 2
You know the right answer?
Write a java class named numberconverter that provides methods to accept strings of binary or octal...
Questions
question
Spanish, 25.03.2021 18:30
question
English, 25.03.2021 18:30
question
Mathematics, 25.03.2021 18:30
question
Mathematics, 25.03.2021 18:30
Questions on the website: 13722363