You only ask for a metal type once. Move the two lines where you request and get the user input inside the while :
while (!doesUserWantToLeave) { Console.WriteLine("Please specify the type of conversion you would like to accomplish:" + "\n(Bronze, Silver, 14k Gold, 18k Gold, 22k Gold, Platinum, or Exit):"); string conversionType = Console.ReadLine(); if (conversionType == "Bronze") { ...
You mentioned that you are new to programming and know that you are repeating yourself. You prioritize correctly to get code working first. It's good. Once you get it working, you should look at the code improvement.
Firstly, after each if following three lines are repeated, so they need to be set only once at the top of the loop:
Console.WriteLine("What is the weight of the wax model?"); wW = Console.ReadLine(); waxWeight = double.Parse(wW);
Further, the last two lines in each if are largely repeated, but the only part that changes (metal name) is known. Therefore, all of them can be deleted and replaced with only one copy at the end of the cycle:
Console.WriteLine("You need " + metalWeight + " grams of {0}.", conversionType.ToLower()); Console.ReadLine();
Then it just leaves one line for if . It is also repeated, and the necessary values ββcan be stored in the dictionary. Do all this and you might get a solution like:
static void Main(string[] args) { bool userWantsToStay = true; var conversions = new Dictionary<string, double> { { "Bronze", 10.0 }, { "Silver", 10.5 }, { "14k Gold", 13.5 }, { "18k Gold", 15.0 }, { "22k Gold", 17.3 }, { "Platinum", 21.5 } }; while (userWantsToStay) { Console.WriteLine("Please specify the type of conversion you would like to accomplish:"); Console.WriteLine("(Bronze, Silver, 14k Gold, 18k Gold, 22k Gold, Platinum, or Exit):"); var metalType = Console.ReadLine(); Console.WriteLine("What is the weight of the wax model?"); var wW = Console.ReadLine(); var waxWeight = double.Parse(wW); if (conversions.ContainsKey(metalType)) { var metalWeight = waxWeight * conversions[metalType]; Console.WriteLine("You need {0} grams of {1}.", metalWeight, metalType.ToLower()); Console.ReadLine(); } else if (metalType == "Exit") { userWantsToStay = false; } else { Console.WriteLine("Sorry! That was an invalid option! Try again"); Console.ReadLine(); } } }
This can be further improved (many ReadLines can be removed, you do not check if the weight entry is a valid double before parsing), but it will set you on the right path.