Question: In previous chapters, you created programs for Marshall s Murals. Now, add aMural class to your code with the following characteristics: The Mural class contains

In previous chapters, you created programs for Marshalls Murals. Now, add aMural class to your code with the following characteristics:
The Mural class contains public static arrays that hold mural codes and descriptions. Recall that the mural categories are Landscape, Seascape, Abstract, Childrens, and Other. Name these arrays muralCodes and muralTypes respectively.
The class contains an auto-implemented property that holds a mural customers name.
The class contains fields for a mural code (code) and description (muralType). The set accessor for the code assigns a code only if it is valid. Otherwise, it assigns I for** Invalid**. The mural description is a read-only property that is assigned a value when the code is set.
In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", CultureInfo.GetCultureInfo("en-US")));
here is the coding from the last chapter :
using System;
using static System.Console;
using System.Globalization;
class MarshallsRevenue
{
static void Main()
{
const int MAX_MURALS =30;
int month;
int numInterior;
int numExterior;
int total;
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 isInteriorGreater = false;
int[] interiorCounts ={0,0,0,0,0};
int[] exteriorCounts ={0,0,0,0,0};
month = getMonth();
numInterior = getNumMurals("interior");
if(month ==12|| month ==1|| month ==2)
numExterior =0;
else
numExterior = getNumMurals("exterior");
total = computeRevenue(month, numInterior, numExterior);
WriteLine("Total revenue expected is {0}", total.ToString("C", CultureInfo.GetCultureInfo("en-US")));
if(numInterior > numExterior)
isInteriorGreater = true;
WriteLine("It is {0} that there are more interior murals scheduled than exterior ones.", isInteriorGreater);
dataEntry("interior", numInterior, interiorCustomers, muralCodes, muralCodesStrings, interiorCodes, interiorCounts);
dataEntry("exterior", numExterior, exteriorCustomers, muralCodes, muralCodesStrings, exteriorCodes, exteriorCounts);
WriteLine("
The interior murals scheduled are:");
for(x =0; x < interiorCounts.Length; ++x)
WriteLine("{0,-20}{1,5}", muralCodesStrings[x], interiorCounts[x]);
WriteLine("
The exterior murals scheduled are:");
for(x =0; x < exteriorCounts.Length; ++x)
WriteLine("{0,-20}{1,5}", muralCodesStrings[x], exteriorCounts[x]);
getSelectedMurals(muralCodes, muralCodesStrings, numInterior, numExterior, interiorCustomers, interiorCodes, exteriorCustomers, exteriorCodes);
}
private static int getMonth()
{
int month =0;
string entryString;
bool isValid = false;
Write("Enter the month >>");
entryString = ReadLine();
while(!isValid)
{
if(int.TryParse(entryString, out month))
if(month<1|| month >12)
{
Write("Invalid month. Enter the month >>");
entryString = ReadLine();
}
else
isValid = true;
else
{
Write("Wrong format. Enter the month >>");
entryString = ReadLine();
}
}
return month;
}
private static int getNumMurals(string location)
{
int num =0;
string entryString;
bool isValid = false;
const int MIN_MURALS =0;
const int MAX_MURALS =30;
Write("Enter number of {0} murals scheduled >>", location);
entryString = ReadLine();
while(!isValid)
{
if(int.TryParse(entryString, out num))
if(num < MIN_MURALS || num > MAX_MURALS)
{
WriteLine("Number must be between {0} and {1} inclusive", MIN_MURALS, MAX_MURALS);
Write("Enter number of {0} murals scheduled >>", location);
entryString = ReadLine();
}
else
isValid = true;
else
{
WriteLine("Invalid format");
Write("Enter number of {0} murals scheduled >>", location);
entryString = ReadLine();
}
}
return num;
}
private static int computeRevenue(int month, int numInterior, int numExterior)
{

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!