Write a console program to allow a user to do conversions between two different units of measurement. C#
Please read carefully the specifications for the tasks given below – you will lose
marks if your programs do not do what is specified.
Write a console program to allow a user to do conversions between two different units of
measurement. So, the user might type in an amount, and the names of two units of
measurement, for example (note the format):
5, ounce, gram
In this case the program should then print out the number of grams equal to 5 ounces, thus:
5 ounces is 140 grams (1 ounce is 28 grams)
Unit names and conversion factors will be supplied as a file convert.txt, and this should be
read in once by the program at start-up. The file consists of a series of lines, each
consisting of two unit names (both strings) and a conversion factor (a number with a decimal
point) separated by commas, for example:
ounce,gram,28.0
This means that one ounce equals 28.0 grams. There may be blanks (as in “gram , ounce,
0.036”) A sample file is available on the portal, but your program should be able to cope with
any file laid out in this way. You will need “using System.IO;” at the start of the program for
functions that open and read from a file. You are allowed to use a StreamReader and the
corresponding method .ReadLine (check google or consult a textbook about C#). .Split
and .Length are allowed, .ToDouble, .ToInt, .ToString are allowed. If you need more help
with how to proceed with this program, see your practical class supervisor.
If the user types in an incompatible pair of units (such as 5, gram, pint) the program should
take appropriate action. Your program should repeatedly prompt the user for an amount. As
long as a positive amount is typed in, the program should proceed with the conversion; when
a zero or negative amount is typed in the program should halt.
Provide a single C# file containing the functions/methods/sub-routines requested in the task
defined below and a Main program that tests the routines appropriately. The file should be
suitably laid out and commented according to good programming style.
Don’t code graphical user interfaces — use a console application. GUIs will not attract more
marks, but likely make the code less readable. This could reduce marks.
Don’t use programming constructs on top of the basic “C-core”.
Keep your code simple and clear.
Place your order now for a similar paper and have exceptional work written by our team of experts to guarantee you A Results
Why Choose US
6+ years experience on custom writing
80% Return Client
Urgent 2 Hrs Delivery
Your Privacy Guaranteed
Unlimited Free Revisions


