Chat with us, powered by LiveChat JAVA | Writedemy

JAVA

JAVA

Create a base class LongInteger that represents a single long integer value in decimal (base 10). The class should have methods that allow you to add, subtract, multiply, and divide two LongInteger objects. Each of these methods should return a new LongInteger object or modify an existing LongInteger. There should also be get and set methods to allow the value of the integer to be changed. Implement a toString() which returns the string representation of the integer in the appropriate base.

Derive a class from LongInteger called BinaryInteger, which is a binary version of LongInteger.
It should be able to do all the things LongInteger does (add, subtract, multiply, divide) by means of inheritance. Of course, the toString method needs to return a binary number in string format.

Derive a class from LongInteger called OctalInteger, which is a base 8 version of LongInteger. As with BinaryInteger, OctalInteger should have add, subtract, multiply, divide methods through inheritance. It should also have its own toString.

Derive a class from LongInteger called HexInteger, which is a hexadecimal (base 16) version of LongInteger with the same attributes and methods as the others. It should also have its own toString.

Create a class IntDriver which will contain a main method. The class should do the following:

1. Present the user with a display that allows them to select one of the above four modes. The user is then supposed to enter a number of that type. If the number they enter is not of the specified type, throw an exception to handle it. The type of exception you throw is up to you, but you should include the type of number expected and the input the user entered. This information should be printed to the screen (ex: BinaryInteger

expected, user entered 1010102). The user should then be re-prompted for an integer

of the chosen type.

2.Enter an operator (+, -, * or /)

3.Enter a second number.

4.Enter “=” to perform the calculation and display the result.

Decimal mode

Bin – Binary +

Oct – Octal –

Dcm – Decimal *

Hex – Hexadecimal /

Q -Quit =

Option or value –> oct

Octal mode

Bin – Binary +

Oct – Octal –

Dcm – Decimal *

Hex – Hexadecimal /

Q -Quit =

Option or value –> 675

Octal mode

675 (octal)

Bin – Binary +

Oct – Octal –

Dcm – Decimal *

Hex – Hexadecimal /

Q -Quit =

Option or value –> +

Octal mode

675 (octal) +

Bin – Binary +
Oct – Octal –
Dcm – Decimal *
Hex – Hexadecimal /

Q -Quit =

Option or value –> 765

Octal mode

675 (octal) + 765 (octal)

Bin – Binary +

Oct – Octal –

Dcm – Decimal *

Hex – Hexadecimal /

Q -Quit =

Option or value –> =

Octal mode

1662 (octal)

Bin – Binary +
Oct – Octal –
Dcm – Decima *

Hex – Hexadecimal /

Q -Quit =

Option or value –> Q

(Additional)

Be sure to state that you’re attempting your work in the comments at the top of your IntDriver.java file.

· Enhance your calculator to handle negative values .

· Write your own methods to convert to and from decimal to binary, octal and hex.

NOTE

If you properly utilize inheritance on this assignment, your derived classes will be quite small in terms of the code they contain. Try to design your base class such that everything can be re- used or built on in your derived classes.

Here is the link for ( LongInteger.jar )

https://www.file-upload.com/okdemltfhd37

To Turn In

Turn in all source code in a single zip file.

 

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order