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
Amass of 1.5 kg of air at 120 kpa and 24°c is contained in a gas-tight, frictionless piston-cylinder device. the air is now compressed to a final pressure of 720 kpa. during the process, heat is transferred from the air such that the temperature inside the cylinder remains constant. calculate the boundary work input during this process.
Answers: 2
question
Engineering, 03.07.2019 19:30
When using the ohmmeter function of a digital multimeter, the leads are placed in what position relative to the component being tested? a. parallel b. control c. series d. line
Answers: 3
question
Engineering, 04.07.2019 18:10
Air is to be cooled in the evaporator section of a refrigerator by passing it over a bank of 0.8-cm-outer-diameter and 0.4-m-long tubes inside which the refrigerant is evaporating at -20°c. air approaches the tube bank in the normal direction at 0°c and 1 atm with a mean velocity of 4 m/s. the tubes are arranged in-line with longitudinal and transverse pitches of sl- st 1.5 cm. there are 30 rows in the flow direction with 15 tubes in each row. determine (a) the refrigeration capacity of this system and (b) pressure drop across the tube bank. evaluate the air properties at an assumed mean temperature of -5°c and 1 atm. is this a good assumption?
Answers: 1
question
Engineering, 04.07.2019 18:10
Determine whether or not it is possible to compress air adiabatically from k to 140 kpa and 400 k. what is the entropy change during this process?
Answers: 3
You know the right answer?
Write a java class named numberconverter that provides methods to accept strings of binary, octal or...
Questions