subject

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: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:00, michelle7511
Which database model is best used for data warehouse and data mining
Answers: 3
image
Computers and Technology, 23.06.2019 22:20, kandi2565
What is a programming method that provides for interactive modules to a website?
Answers: 1
image
Computers and Technology, 24.06.2019 02:10, sIatt
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
Answers: 2
image
Computers and Technology, 24.06.2019 07:00, AnaiyaKirksey8
You are most likely to automatically encode information about
Answers: 1
You know the right answer?
Write a java class named numberconverter that provides methods to accept strings of binary, octal or...

Questions in other subjects:

Konu
Mathematics, 25.05.2021 22:10