Question
All in C# In Chapter 4 of your book, you created an interactive application named MarshallsRevenue that prompts a user for the number of interior
All in C#
In Chapter 4 of your book, you created an interactive application named MarshallsRevenue that prompts a user for the number of interior and exterior murals scheduled to be painted during a month and computes the expected revenue for each type of mural. The program also prompts the user for the month number and modifies the pricing based on requirements listed in Chapter 4. Now, modify the program so that the user must enter a month value from 1 through 12. If the user enters an incorrect number, the program prompts for a valid value. Also, the user must enter a number between 0 and 30 inclusive for the number of murals of each type; otherwise, the program prompts the user again. I have my own code from before but I dont know how to modify it. Can you help me?
using System; using static System.Console; class MarshallsRevenue { static void Main() { const int INTERIOR_PRICE = 500; const int EXTERIOR_PRICE = 750; string entryString; int numInterior; int numExterior; int revenueInterior; int revenueExterior; int total; int month; bool isInteriorGreater; Write("Enter the month number:"); entryString = ReadLine(); month = Convert.ToInt32(entryString); 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); switch(month){ case 1: case 2: case 12: numExterior = 0; revenueInterior = numInterior * INTERIOR_PRICE; revenueExterior = numExterior * EXTERIOR_PRICE; break; case 4: case 5: case 9: case 10: revenueInterior = numInterior * INTERIOR_PRICE; revenueExterior = numExterior * 699; break; case 7: case 8: revenueInterior = numInterior * 450; revenueExterior = numExterior * EXTERIOR_PRICE; break; default: revenueInterior = numInterior * INTERIOR_PRICE; revenueExterior = numExterior * EXTERIOR_PRICE; break; }
total = revenueInterior + revenueExterior; isInteriorGreater = numInterior > numExterior; WriteLine("{0} interior murals are scheduled for a total of {2}", numInterior, INTERIOR_PRICE.ToString("C"), revenueInterior.ToString("C")); WriteLine("{0} exterior murals are scheduled 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); } }
Thank you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started