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 autoimplemented 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 readonly 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: WriteLineThis is an example: value.ToStringC CultureInfo.GetCultureInfoenUS;
here is the coding from the last chapter :
using System;
using static System.Console;
using System.Globalization;
class MarshallsRevenue
static void Main
const int MAXMURALS ;
int month;
int numInterior;
int numExterior;
int total;
string interiorCustomers new stringMAXMURALS;
string exteriorCustomers new stringMAXMURALS;
char muralCodes LSACO;
string muralCodesStrings Landscape "Seascape",
"Abstract", "Children's", "Other";
char interiorCodes new charMAXMURALS;
char exteriorCodes new charMAXMURALS;
int x;
bool isInteriorGreater false;
int interiorCounts ;
int exteriorCounts ;
month getMonth;
numInterior getNumMuralsinterior;
ifmonth month month
numExterior ;
else
numExterior getNumMuralsexterior;
total computeRevenuemonth numInterior, numExterior;
WriteLineTotal revenue expected is total.ToStringC CultureInfo.GetCultureInfoenUS;
ifnumInterior numExterior
isInteriorGreater true;
WriteLineIt is that there are more interior murals scheduled than exterior ones.", isInteriorGreater;
dataEntryinterior numInterior, interiorCustomers, muralCodes, muralCodesStrings, interiorCodes, interiorCounts;
dataEntryexterior numExterior, exteriorCustomers, muralCodes, muralCodesStrings, exteriorCodes, exteriorCounts;
WriteLine
The interior murals scheduled are:";
forx ; x interiorCounts.Length; x
WriteLine muralCodesStringsx interiorCountsx;
WriteLine
The exterior murals scheduled are:";
forx ; x exteriorCounts.Length; x
WriteLine muralCodesStringsx exteriorCountsx;
getSelectedMuralsmuralCodes muralCodesStrings, numInterior, numExterior, interiorCustomers, interiorCodes, exteriorCustomers, exteriorCodes;
private static int getMonth
int month ;
string entryString;
bool isValid false;
WriteEnter the month ;
entryString ReadLine;
whileisValid
ifintTryParseentryString out month
ifmonth month
WriteInvalid month. Enter the month ;
entryString ReadLine;
else
isValid true;
else
WriteWrong format. Enter the month ;
entryString ReadLine;
return month;
private static int getNumMuralsstring location
int num ;
string entryString;
bool isValid false;
const int MINMURALS ;
const int MAXMURALS ;
WriteEnter number of murals scheduled location;
entryString ReadLine;
whileisValid
ifintTryParseentryString out num
ifnum MINMURALS num MAXMURALS
WriteLineNumber must be between and inclusive", MINMURALS, MAXMURALS;
WriteEnter number of murals scheduled location;
entryString ReadLine;
else
isValid true;
else
WriteLineInvalid format";
WriteEnter number of murals scheduled location;
entryString ReadLine;
return num;
private static int computeRevenueint month, int numInterior, int numExterior
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
