Hi all


I'm working in the program which create two objects

both object contains type , color , price, weight

And I done with but the problem is how I can round the number in price and weight

becuse i change the weight from pound to kg

how i can do that ??

Cheap and dirty rounding trick: add 0.5 and convert to int. Fails for negative numbers, of course. Think about what you'd do to make it work for negatives as well - and then go ahead and use the library method.
(It's always a good idea to use a library method where they are available, but it's also well worth the trouble to think about how you'd solve it yourself if you have to)

I google it and I find method that help me with it

thanks all for help =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.