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.
  • Go back-and-forth until satisfied
    Rate the answer you receive.
Ask LogicPro Your Own Question
LogicPro
LogicPro, Computer Software Engineer
Category: Programming
Satisfied Customers: 26086
Experience:  Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
29751445
Type Your Programming Question Here...
LogicPro is online now

I am progamming in java and I need a working example to

This answer was rated:

Hello, I am progamming in java and I need a working example to learn how to use BigDecimal for the excercise I am doing.
I am trying to add two double variables but the result gives me a negative number.
Do I need to use Big Decimal on the 2 variables and the result? Please can someone provide a working example?
Thank you.

HI

Welcome

Could you please elaborate

Customer: replied 3 years ago.
Hello, yes, I am working with money and I am trying to add an incoming transaction to my current balance, but I keep getting a negative amount. I have already got Decimal Format set to display £0.00 and that works fine. It's just BigDecimal I'm having problems with. I just need a working example of how to use Big Decimal on the transaction and current balance and result.
Please can you show me how to do this in Command Prompt only? Thank you.

Can you provide me your line of codes having issues along with data?

Customer: replied 3 years ago.
No, that;s very time consuming and complex. All I'm asking for is a working example so I can learn how to use BigDecimal for 3 values, the transaction, the current balance and the result.

Let me understand

So you need to see the example on how to add two double values using BigDecimal?

Customer: replied 3 years ago.
to avoid getting a negative value for a result. Please can you provide an example I can view in Command Prompt.

Check this code and let me know:

https://pastebin.com/raw/vywXk2S2

Customer: replied 3 years ago.
Thank you, ***** *****!

Welcome

Leave your rating by selecting five stars located on the top right of the question page. Giving a positive rating compensates the Expert for their time with you. Please remember that your Expert will not be paid until you leave a positive rating for the answer. If the stars are grayed out or you cannot click on the stars to rate your experience, reply to your Expert and let them know so they can adjust your question and allow you to rate.

Please consider adding bonus after rating

http://ww2.justanswer.com/help/what-if-expert-does-really-fantastic-job-hl

You can also come back and add a bonus at a later date by using the "Write a review or give a bonus" button on your question page.

We can continue the conversation until you're satisfied and rate my answer as excellent to credit me. I can address follow up questions and I'm always here to help.

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers. It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Thank you for using this site!

LogicPro

LogicPro and 3 other Programming Specialists are ready to help you