Write a program to allow a user to do conversions between two different units of measurement in C# They have to be converted Grams to Ounce.
I'm not going to write a whole program for you and i doubt any one will
however to get grams to ounces you times by 0.0352739619 and to get ounces to grams you divide by 0.0352739619
That sounds a tad like a homework assignment to me, so I won't downright write it for you. ;) First of all, you need an input box (use Unity's GUI for that) and a conversion function, which takes a value in and spits a value out. Something which looks like this (in C#):
float ConvertGramsToOunces(float grams) {
float ounces = grams * 0.0352739619;
return ounces;
}
Call it like this:
float grams = 10.0f;
float returnedOunces = ConvertGramsToOunces(grams);
Which would return `0.352739619`.
There. Now all you need to do is write a user interface using the link I provided you and you're all set.