I am making a calculator for a project,using Swing but I am finding one task particulary hard because it is something I have not yet learned. So for this calculator I need a rounding menu I have a list of menu items 0 through to 9 which stipulate the rounding precision to be applied to all calculations. I have taken a screen shot to give you an idea.
I am not sure how to do this, online I have found many people mention the BigDecimal class and one of the instructors told me to search for the round method, however I am looking at both of these options but I am not sure how to implement them.
I thought I would ask if any one had any similar code samples I could look at.
Jump to Post
1/ basic and strong Assembler's rounding mode
int baseInt = (doubleNumber + (0.05))/100 double roundedNumber = baseInt * 100
2/ rounding problems if NumberValue ends with 3,6,9, sometimes (lots of decimal places) I never check why, never solved, just ignored, compared with outPut/rounding from …
All 3 RepliesReply to this topic
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.