Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your HexaicosadecimalNumber class should know how to express a number in both hexaicosadecimal and decimal. To do this, it should have two attributes: stringRepresentation and

Your HexaicosadecimalNumber class should know how to express a number in both hexaicosadecimal and decimal. To do this, it should have two attributes: stringRepresentation and doubleRepresentation. (What types should these variables be, and what should their access modifiers be?)
Your HexaicosadecimalNumber class should have two constructors, both of which will populate the two attributes appropriately. One will take as input a String (representing a number in hexaicosadecimal), and the other will take as input a double. Both methods have to populate both attributes.
You might now be thinking, How do I populate both attributes when I only have one representation as input to the constructor? You will need two helper functions: hexaicosadecimalStringToDouble(String in) and doubleToHexaicosadecimalString(double in). You should call these functions in your constructors as needed.
You should also override the toString() method of HexaicosadecimalNumber. This is a special method that belongs to Javas Object() class, from which all other classes including HexaicosadecimalNumber are derived. The signature of the toString() method is
public String toString()
As you can see from the method signature, this function is public, takes no arguments, and returns a String. This function is called automatically when an object of that class is printed, for example by System.out.println().The string should be in the following format:
stringRepresentation (doubleRepresentation)
That is, if your hexaicosadecimal number object is named temp and contains the value abcde (for which the equivalent decimal representation is 19010.0; check this later!), the result of
calling
System.out.println(temp)
should be
abcde (19010.0)
For the two helper functions - hexaicosadecimalStringToDouble(String in) and doubleToHexaicosadecimalString(double in) just have them return dummy values for now. (I.e. return 0.0 from the first function, and NOT IMPLEMENTED from the second.) At this point, you should have a complete working program (that doesnt do much). Compile and run your program. If you encounter errors, fix them before continuing.
image text in transcribed
You should also be familiar with base-2 (binary), in which there are only two values: 0,1 There are several other number systems that are important to computer scientists, including base-8 (octal): 0,1,2,3,4,5,6,7Andbase-16(hexadecimal):0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f I've got a typewriter on which, unfortunately, all the number keys are broken. But I still want to do maths! Luckily, all the letter keys work, so I've got a handy set of 26 symbols laying around. So I'm in luck: All I have to do is write out my numbers in base-26 (hexaicosadecimal)! Now, I've gotten pretty good at thinking in hexaicosadecimal, but I keep getting bad grades in maths because nobody else can understand it! Your job is to help me out by writing a Java program that can convert numbers from base- 10 to base-26 and vice versa

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

16.7 Describe the three steps in the collective bargaining process.

Answered: 1 week ago

Question

3. What information do participants need?

Answered: 1 week ago