static void GetMuralInfo(Mural[] murals) { for (int index = 0; index < murals.Length; index++) { murals[index] = new Mural(); Write("Enter the customer's name: "); murals[index].CustomerName = ReadLine(); murals[index].Code = "I"; while (murals[index].Code == "I") { Write("Enter a mural code: ("); foreach (string muralCode in Mural.muralCodes) { Write("({0})", muralCode); } Write(")"); murals[index].Code = ReadLine(); } } }
static void DisplayMuralInfo(Mural[] interiorMurals, Mural[] exteriorMurals) { string userInput = ""; while (userInput != "*") { Write("Enter a code to see the information for that mural: "); userInput = ReadLine(); Mural inputMural = new Mural(); inputMural.Code = userInput; if (inputMural.Code != "I") { bool hasMurals = false; WriteLine("--- {0} Interior Murals ---", inputMural.Description); foreach (Mural mural in interiorMurals) { if (mural.Code == inputMural.Code) { WriteLine("Customer Name: {0}", mural.CustomerName); hasMurals = true; } } if (!hasMurals) { WriteLine("There are no murals with that code"); } hasMurals = false; WriteLine("--- {0} Exterior Murals ---", inputMural.Description); foreach (Mural mural in exteriorMurals) { if (mural.Code == inputMural.Code) { WriteLine("Customer Name: {0}", mural.CustomerName); hasMurals = true; } } if (!hasMurals) { WriteLine("There are no murals with that code"); } } } }
static void Main() { int numberOfInteriorMurals = -1; int numberOfExteriorMurals = -1; int month = 0; numberOfInteriorMurals = GetNumberOfMurals("Enter the number of interior murals estimated for next month: "); numberOfExteriorMurals = GetNumberOfMurals("Enter the number of exterior murals estimated for next month: "); month = GetMonth(); double totalRevenue = DisplayPricesAndReturnRevenue(numberOfInteriorMurals, numberOfExteriorMurals, month); Mural[] interiorMurals = new Mural[numberOfInteriorMurals]; Mural[] exteriorMurals = new Mural[numberOfExteriorMurals]; WriteLine("--- Interior Murals ---"); GetMuralInfo(interiorMurals); WriteLine("--- Exterior Murals ---"); GetMuralInfo(exteriorMurals); DisplayMuralInfo(interiorMurals, exteriorMurals); }