subject
Engineering, 13.09.2019 01:10 dearydn22

Write a java class named numberconverter that provides methods to accept strings of binary, octal or hexadecimal numbers and converts them to the decimal equivalent string. the class should provide the methods binaryconverter, octalconverter and hexadecimalconverter.
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.
the method hexadecimalconverter parses an input string of a hexadecimal 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
The y form of iron is known as: a) ferrite b) cementite c) perlite d) austenite
Answers: 3
question
Engineering, 04.07.2019 18:10
Abrake has a normal braking torque of 2.8 kip in and heat-dissipating cast-iron surfaces whose mass is 40 lbm. suppose a load is brought to rest in 8.0 s from an initial angular speed of 1600 rev/min using the normal braking torque; estimate the temperature rise of the heat dissipating surfaces.
Answers: 3
question
Engineering, 04.07.2019 18:10
Journeyman training is usually related (clo2) a)-to specific tasks b)-to cost analysis of maintenance task c)-to control process to ensure quality d)-to installation of machinery
Answers: 2
question
Engineering, 04.07.2019 19:10
An electric kettle is made out of stainless steel, weighs two pounds (when empty) and is equipped with a heating element that consumes 2 kw of electricity. assuming that the water and the kettle are at the same uniform temperature at any moment of time, calculate the shortest possible time to bring 2 quarts of water from room temperature to the onset of boiling
Answers: 2
You know the right answer?
Write a java class named numberconverter that provides methods to accept strings of binary, octal or...
Questions
question
English, 22.08.2020 21:01
Questions on the website: 13722367