Write a 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:
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)
The unit names and conversion factors will be supplied as a file
convert.txt, and this should be read in 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:
This means that one ounce equals 28.0 grams. A sample file is
available on the portal, but your program should be able to cope
with any file laid out in this way. There is code in section A of the
“LinkedList” project to read from such a file; you need “using
System.IO;” at the start of the program. If you need more help
Page 4 of 5with how to proceed with this program, see your practical class
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.

Hey guys, that is part of my assignment, Can anyone point me to the right track on what to do or how to start?
What I have in mind is,

Load the text file,
Get user input,
split the string,
Search the array for matches from the text file,
Then i'm stuck :(


6 Years
Discussion Span
Last Post by neoic91
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.