How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask R.R. Jha Your Own Question

R.R. Jha
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience:  B.Tech
20870358
Type Your Homework Question Here...
R.R. Jha is online now
A new question is answered every 9 seconds

Hey LogicPro! I have a question for you. I need to create

This answer was rated:

Hey LogicPro! I have a question for you.

I need to create a Java program designed to function basically as a calculator while models arbitarily large, signed integers. It has to be able to take in numbers (as strings) for arguments, and they have to be allowed to be of arbitrary size. The person testing my program could potentially put in arguments with millions of digits.

I have more specific details, but they don't fit in this question box. I'd very much appreciate your assistance!
Hi,
Welcome back

What is the deadline?

Provide the code.
Customer: replied 3 years ago.



The dead line is in a little under 24 hours. It could be as late as Friday.



Here are some more rules for the program:




  • You must implement your program from first principles, e.g., you may not use java.math.BigInteger.

  • The numbers involved in each computation may consist of millions of (decimal) digits.

  • Your unfinished methods must throw new UnsupportedOperationException() .

  • Your main() method should implement a kind of command-line calculator; for example, if I were to invoke your program like this java Ginormint 135531123487687632457563755619283 product 857093475579357093874532400394, it should output the resulting product. The permissible operator-words are sum, difference, product, quotient, and remainder.



The code must be presented in this order:



Create your code in this order:



  1. public static void main ( String[] )

  2. public Ginormint ( String ) // the constructor

  3. public String toString ()

  4. test code for each of the next five methods

  5. public Ginormint sum ( Ginormint )

  6. public Ginormint difference ( Ginormint )

  7. public Ginormint product ( Ginormint )

  8. public Ginormint quotient ( Ginormint )

  9. public Ginormint remainder ( Ginormint )

  10. optional methods together with their test code



Here's what code I have so far. I'm really not attached to it, so it can change as much as you deem necessary. Hope it helps:



http://ge.tt/8REobib/v/0



I will check and let you know ASAP.
Customer: replied 3 years ago.
thanks, LogicPro! i'll be waiting.
ok
My apologies. tried but lost. I am out of ideas and opting out for other Professionals to answer. Please wait. You will be notified by email as soon as any Professional joins you. I will help you with your other questions though. Thank you for your patience.
Customer: replied 3 years ago.

Not a problem at all! thanks very much, i'll be waiting other responses.

Hi there,

I can help you with the requirement.
By when do you need the solution?

Thank you
Customer: replied 3 years ago.
hey raj! pretty much any time before 6 pm PST tomorrow would be great, but it's not a hard and fast requirement.
Ok no problem I will try to finish it before deadline....
I am sending an underprice report based on effort required to finish this.

Customer: replied 3 years ago.

hey, raj! i was just checking in to see how progress is on the problem, and if you needed any additional information.

I sent an underprice report long back but you never responded to it.
Customer: replied 3 years ago.

ooooh, my bad. allow me to respond to it, for some reason i completely blanked on that.

No problem it happens...
Customer: replied 3 years ago.

hey raj. i've updated the price a bit.

Yes I can see that....
But the price is oess than the report I sent.
Customer: replied 3 years ago.

oooh, sorry, i didn't check the actual price. edited again.

Ok No Problem...
Can you please specify me the new deadline

Also Can I have a look on the code you have already written??

Customer: replied 3 years ago.
it possible, i would appreciate it by six o'clock tomorrow at the latest.
yes can I have a look on the code you have written??

Thank you
Customer: replied 3 years ago.

sorry for this late response, but here's what code i have so far:


 


http://ge.tt/4dnOUAc/v/0

No problem...
The link you provided says the files have been removed.
Can you please upload them again?

thank you
Customer: replied 3 years ago.

sure thing, here you go:

 

http://www.speedyshare.com/dATE4/Ginormint.java

 

just in case, here are the specifications again for the program:

 

    • You must implement your program from first principles, e.g., you may not use java.math.BigInteger.

    • The numbers involved in each computation may consist of millions of (decimal) digits.

    • Your unfinished methods must throw new UnsupportedOperationException() .

    • Your main() method should implement a kind of command-line calculator; for example, if I were to invoke your program like this java Ginormint 135531123487687632457563755619283 product 857093475579357093874532400394, it should output the resulting product. The permissible operator-words are sum, difference, product, quotient, and remainder.



The code must be presented in this order:

Create your code in this order:



    1. public static void main ( String[] )

    1. public Ginormint ( String ) // the constructor

    1. public String toString ()

    1. test code for each of the next five methods

    1. public Ginormint sum ( Ginormint )

    1. public Ginormint difference ( Ginormint )

    1. public Ginormint product ( Ginormint )

    1. public Ginormint quotient ( Ginormint )

    1. public Ginormint remainder ( Ginormint )

    1. optional methods together with their test code



ok got the file this time....
Customer: replied 3 years ago.

Relist: Incomplete answer. I never received an answer, and the post has been up for over a week now.

Hi,

I'd be glad to help with this. I'll work it out and get back to you soon.


Thanks
Customer: replied 3 years ago.

Thanks very much! i'm happy to provide any extra information you may need.

Ok, no further information needed at this time.

Thanks
THIS ANSWER IS LOCKED!

You need to spend $3 to view this post. Add Funds to your account and buy credits.
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience: B.Tech
R.R. Jha and 3 other Homework Specialists are ready to help you
Customer: replied 3 years ago.

This is perfect! I will rate your response soon so you can receive your parent. Before I do, though, I just have one question.


 


What is the "si" object being called here:


 


public Ginormint(Ginormint si) {

magnitude = si.magnitude;
sign = si.sign;


 


i can't tell if it's an object within Java, or something you created for the program.

It's just name of another Ginormint object. We could put any other variable name instead.
Customer: replied 3 years ago.

oooh, duuuuh. man, i should have realized that sooner. one more question: in that little snippet of code i copypasted, what is the purpose of combining the Ginormint object "si" with the fields "sign" and "magnitude", as in si.magnitude and si.sign.


 


what does that do to the ginormint object?

si.magnitude refers to magnitude of object si, which is in fact a 'Ginormint' number. Similarly, si.sign refers to sign of the number.
That code snippet is for Ginormint constructor, and si is the Ginormint which is passed as the parameter to this constructor. When we assign si's magnitude and sign to this instance of Ginormint, we are in effect creating just another copy of si.
Customer: replied 3 years ago.

Well, thank you very much. Those are all my questions, and you answered perfectly. Thank you!

 

i'll be rating you in just a moment

You're welcome!

Let me know if you need help with any other projects in future. Just add 'RRJha' at the start of your new question to send it directly to me.


Thanks

Related Homework Questions