Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

In previous chapters, you created applications for Marshalls Murals. Now, modify the version of the MarshallsRevenue program created in Chapter 5 so that after mural

In previous chapters, you created applications for Marshalls Murals.

Now, modify the version of the MarshallsRevenue program created in Chapter 5 so that after mural data entry is complete, the user is prompted for the appropriate number of customer names for both the interior and exterior murals and a code for each that indicates the mural style:

  • L for landscape
  • S for seascape
  • A for abstract
  • C for childrens
  • O for other

When a code is invalid, reprompt the user for a valid code continuously. For example, if Y is input, output Y is not a valid code, and reprompt the user until a valid code is entered.

After data entry is complete, display a count of each type of mural. For example the output should be in the following format with the correct number next to each mural type:

The interior murals scheduled are: Landscape 1 Seascape 2 Abstract 1 Children's 3 Other 9 The exterior murals scheduled are: Landscape 4 Seascape 0 Abstract 2 Children's 4 Other 0

Then, continuously prompt the user for a mural style code until the user enters a sentinel value (the uppercase character Z should be used as the sentinel value).

With each code entry, display a list of all the customers with that code and whether their mural is interior or exterior. If the requested code is invalid, display an appropriate message and reprompt the user. For example if L is input, the ouput might be:

Customers ordering Landscape murals are: Katie Interior Jake Exterior

If U is entered, the output should be U is not a valid code.

image text in transcribed

PROVIDED CODE BELOW

using System; using static System.Console; class MarshallsRevenue { static void Main() { const int INTERIOR_PRICE = 500; const int DISCOUNT_INTERIOR_PRICE = 450; const int EXTERIOR_PRICE = 750; const int DISCOUNT_EXTERIOR_PRICE = 699; const int MIN_MURALS = 0; const int MAX_MURALS = 30; string entryString; int month; int numInterior; int numExterior; int revenueInterior; int revenueExterior; int total; bool isInteriorGreater; string[] interiorCustomers = new string[MAX_MURALS]; string[] exteriorCustomers = new string[MAX_MURALS]; char[] muralCodes = {'L', 'S', 'A', 'C', 'O'}; string[] muralCodesStrings = {"Landscape", "Seascape", "Abstract", "Children's", "Other"}; char[] interiorCodes = new char[MAX_MURALS]; char[] exteriorCodes = new char[MAX_MURALS]; int x; bool isValid; bool found; int pos = 0; int[] interiorCounts = {0, 0, 0, 0, 0}; int[] exteriorCounts = {0, 0, 0, 0, 0}; char option; const char QUIT = 'Z'; Write("Enter the month >> "); entryString = ReadLine(); month = Convert.ToInt32(entryString); while(month 12) { Write("Invalid month. Enter the month >> "); entryString = ReadLine(); month = Convert.ToInt32(entryString); } Write("Enter number of interior murals scheduled >> "); entryString = ReadLine(); numInterior = Convert.ToInt32(entryString); while(numInterior MAX_MURALS) { WriteLine("Number must be between {0} and {1} inclusive", MIN_MURALS, MAX_MURALS); Write("Enter number of interior murals scheduled >> "); entryString = ReadLine(); numInterior = Convert.ToInt32(entryString); } Write("Enter number of exterior murals scheduled >> "); entryString = ReadLine(); numExterior = Convert.ToInt32(entryString); while(numExterior MAX_MURALS) { WriteLine("Number must be between {0} and {1} inclusive", MIN_MURALS, MAX_MURALS); Write("Enter number of Exterior murals scheduled >> "); entryString = ReadLine(); numExterior = Convert.ToInt32(entryString); } if(month == 12 || month ==1 || month == 2) numExterior = 0; if(month == 4 || month == 5 || month ==9 || month ==10) revenueInterior = numInterior * DISCOUNT_INTERIOR_PRICE; else revenueInterior = numInterior * INTERIOR_PRICE; if(month == 7 || month == 8) revenueExterior = numExterior * DISCOUNT_EXTERIOR_PRICE; else revenueExterior = numExterior * EXTERIOR_PRICE; total = revenueInterior + revenueExterior; isInteriorGreater = numInterior > numExterior; WriteLine("{0} interior murals are scheuled at {1} each for a total of {2}", numInterior, INTERIOR_PRICE.ToString("C"), revenueInterior.ToString("C")); WriteLine("{0} exterior murals are scheuled at {1} each for a total of {2}", numExterior, EXTERIOR_PRICE.ToString("C"), revenueExterior.ToString("C")); WriteLine("Total revenue expected is {0}", total.ToString("C")); WriteLine("It is {0} that there are more interior murals scheduled than exterior ones.", isInteriorGreater);

WriteLine("Entering interior jobs:"); x = 0; while(x > "); interiorCustomers[x] = ReadLine(); WriteLine("Mural options are:"); for(int y = 0; y > "); interiorCodes[x] = Convert.ToChar(ReadLine()); isValid = false; while(!isValid) { for(int z = 0; z > "); interiorCodes[x] = Convert.ToChar(ReadLine()); } } ++x; } WriteLine("Entering exterior jobs:"); x = 0; while(x > "); exteriorCustomers[x] = ReadLine(); WriteLine("Mural options are:"); for(int y = 0; y > "); exteriorCodes[x] = Convert.ToChar(ReadLine()); isValid = false; while(!isValid) { for(int z = 0; z > "); interiorCodes[x] = Convert.ToChar(ReadLine()); } } ++x; } WriteLine(" The interior murals scheduled are:"); for(x = 0; x > ", QUIT); option = Convert.ToChar(ReadLine()); while(option != QUIT) { isValid = false; for(int z = 0; z

Write(" Enter a mural type or {0} to quit >> ", QUIT); option = Convert.ToChar(ReadLine()); } } }

Tasks > Program correctly accepts and displays mural and customer information Program correctly handles invalid mural code input Tasks > Program correctly accepts and displays mural and customer information Program correctly handles invalid mural code input

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions