Question: 02. Programming problem In mathematics and computing, hexadecimal is a positional numeral system with a base of 16. It uses sixteen distinct symbols, most often

 02. Programming problem In mathematics and computing, hexadecimal is a positional

02. Programming problem In mathematics and computing, hexadecimal is a positional numeral system with a base of 16. It uses sixteen distinct symbols, most often the symbols 0-9 to represent values zero to nine, and A-F (or alternatively a-f) to represent values ten to fifteen. Consider the following class: public class HexaDecimal( private String hexastr; public HexaDecimal) hexaStr "O"; public HexaDecimal (String s) ( hexastr s public void setex(String s){ hexastr s; } public String getHex) f return hexastr) 1. [5 marks] Implement a method convertO, which computes and returns the integer number that was represented by hexaStr. Note that: if hexaStr is "dsdzddo", then decimal Example: find the decimal value of "2AF3" dox16+ dx161 + dx16 +.. HexaDecimal number: 2 A F 3 power of 16: 163 162 16 16 "2AF3"-3 *16 15 16 +10 16 +2 163 10995 12 marks] Implement the toStringO method, which should returm a String that include the value of binaryStr and its decimal representation. 3. (3 marks] Finally, test the HexaDecimal class using a tester class as follows. Read a hexadecimal number from the user as string. a. b. Create a HeaDecimal object hl with the value of user's entered string. c. Output the object hl and its decimal representation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!