Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In previous chapters, you continued to modify the MarshallsRevenue program. Now, modify the program so that the major functions appear in the following individual methods:

In previous chapters, you continued to modify the MarshallsRevenue program. Now, modify the program so that the major functions appear in the following individual methods:

  • GetMonth - This method prompts for and returns the month
  • GetNumMurals - This method prompts for and returns the number of murals scheduled and is called twice -- once for interior murals and once for exterior murals
  • ComputeRevenue - This method accepts the number of interior and exterior murals scheduled, accepts the month they are scheduled, displays the interior and exterior prices, and then returns the total expected revenue
  • DataEntry - This method fills an array with customer names and mural codes and is called twice -- once to fill the array of interior murals and once to fill the array of exterior murals
  • GetSelectedMurals - This method continuously prompts for mural codes and displays jobs of the corresponding type until a sentinel value is entered.

code i have so far

using System; using static System.Console; class MarshallsRevenue { static void Main() { const int MAX_MURALS = 30; int month, numInterior, numExterior;// total; string[] interiorCustomers = new string [MAX_MURALS]; string[] exteriorCustomers = new string [MAX_MURALS]; char[] muralCods = {'L' , 'S' , 'A', 'C' , 'O'}; string[] muralCodesStrings = {"Landscape", "Seascape", "Abstract", "Children","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(); // WriteLine ("Month enter is {0}" , month); numInterior = GetNumMurals("interior"); numExterior = GetNumMurals("exterior"); //WriteLine("numInterior is {0}, and numExterior is {1}", numInterior, numExterior); int total = ComputeRevenue(month, numInterior, numExterior); } public static int GetMonth() { int month; string entryString; Write("Enter the month >> "); entryString = ReadLine(); month = Convert.ToInt32(entryString); while(month < 1 || month >12) { Write("Invalid month. Enter the month >> "); entryString = ReadLine(); month = Convert.ToInt32(entryString); } return month; } public static int GetNumMurals(string location) { int num; string entryString; const int MIN_MURALS = 0; const int MAX_MURALS = 30; Write("Enter number of {0} murals scheduled >>", location); entryString = ReadLine(); num = Convert.ToInt32(entryString); while(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(); num = Convert.ToInt32(entryString); } return num; } public static int ComputeRevenue(int month, int numInterior, int numExterior) { int revenueInterior; int revenueExterior; int total; const int INTERIOR_PRICE = 500; const int EXTERIOR_PRICE = 750; const int DISCOUNT_INTERIOR_PRICE= 450; const int DISCOUNT_EXTERIOR_PRICE = 699; if(month == 12 || month == 1 || month == 2) numExterior = 0; if(month == 4 || month == 5 || month == 9 || month == 10) revenueExterior = numExterior * DISCOUNT_EXTERIOR_PRICE; else revenueExterior = numExterior * EXTERIOR_PRICE; if(month == 7 || month == 8) revenueInterior = numInterior * DISCOUNT_INTERIOR_PRICE; else revenueInterior = numInterior * INTERIOR_PRICE; total = revenueInterior + revenueExterior; WriteLine("{0} interior murals are scheduled at {1} each for a total of {2}", numInterior, INTERIOR_PRICE.ToString("C"), revenueInterior.ToString("C")); WriteLine("{0} exterior murals are scheduled at {1} each for a total of {2}", numExterior, EXTERIOR_PRICE.ToString("C"), revenueExterior.ToString("C")); return total ; // Write your ComputeRevenue() method here. } public static void DataEntry(string location, int num, string[] customers, char[] muralCodes, string[] muralCodesStrings, char[] codes, int[] counts) { // Write your DataEntry() method here. } public static void GetSelectedMurals(char[] muralCodes, string[] muralCodesStrings, int numInterior, int numExterior, string[] interiorCustomers, char[] interiorCodes, string[] exteriorCustomers, char[] exteriorCodes) { // Write your GetSelectedMurals() method here. } }

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