write a program that will read the weight of a package of breakfast cereal in ounces and output the weight in metric tons as well as the number of boxes neede to yield one metric ton of cereal

Recommended Answers

All 6 Replies

read the weight from where? Does your computer have a scale attached to it? Or do you get that info from typeing it in on the keybaord (most likely) ?

Do google to find the math algorithm for converting ounces to metric units. "metric tons" is a awful lot for a box of cereal :) Or you are buying enough cereal to feed an army. If one box of cereal weighs 16 ounces (one pound) then it would take 2,000 boxes to get one short ton. For other conversions see here.

It'll be better for you to post your coding and tell us what's your problem... : )

Start by accepting the weight in ounces and converting it to grams. Then divide the weight in grams by the number of grams/ton to get the weight in metric tons. Then divide a metric ton by your weight in grams and you have the number of boxes needed.

main question is are u taking it from the user or not?

You need to show at least a bit of effort, not just dump a question and expect us to solve it, you haven't even said what your problem is. What do you expect us to do ?

Be a part of the DaniWeb community

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