Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In JAVA, 2 files, MyNumber and MyNumberTest (provide sample output) Create a class MyNumber which uses a 30-element array of digits to store integers as

In JAVA, 2 files, MyNumber and MyNumberTest (provide sample output)

Create a class MyNumber which uses a 30-element array of digits to store integers as large as 30 digits each.

Provide the following methods:

parse --> Pass a string as input, extract each digit using charAt and place the integer equivalent of each digit into integer array. Ex: You pass "1231412131415" as a string. Using charAt and referring to the each subscript of this string extract characters, convert them into integers, and assign them into 30-element array.

toString --> Display the number. Your typical System.out.println(...) operation...

add and subtract --> These two might be tricky. You are dealing with two MyNumbers here. Ex: mynum1.Add(mynum2); should sum them up, mynum1.Subtract(mynum2) should subtract mynum2 from mynum1.

For comparison, provide the following:

isEqualTo, isNotEqualTo, isGreaterThan, isLessThan --> These are pretty much straightforward boolean operations. Make the comparison and depending on the outcome return true or false.

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

More Books

Students also viewed these Databases questions

Question

Tell me about yourself.

Answered: 1 week ago