Question: C# SAMPLE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CalorieCounter { class Program { const int DAYS_IN_WEEK = 7; const

C#

C# SAMPLE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using

SAMPLE CODE:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CalorieCounter { class Program { const int DAYS_IN_WEEK = 7; const int MEALS_IN_DAY = 3; static string[] DaysOfWeek = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; static string[] MealsOfDay = { "Breakfast", "Lunch", "Dinner" }; static void Main(string[] args) { int[,] calories = {{900, 750, 1020 }, {300, 1000, 2700 }, {500, 700, 2100 }, {400, 900, 1780 }, {600, 1200, 1100}, {575, 1150, 1900 }, {600, 1020, 1700 } }; double[] dailyAverage = new double [DAYS_IN_WEEK]; double[] mealAverage = new double[MEALS_IN_DAY]; Welcome(); dailyAverage = CalculateAverageByDay(calories); mealAverage = CalculateAverageByMeal(calories); DisplayDailyAverage(dailyAverage); DisplayMealAverage(mealAverage); DisplayAverageCaloriesPerMeal(calories); ExitProgram(); }//end Main static double [] CalculateAverageByDay(int[,] calories) { int totalByDay = 0; double [] dailyAverage = new double[DAYS_IN_WEEK]; for(int row = 0; row   or this exercise you are asked to complete the provided CalorieCounter program. This program reads from a two-dimensional array showing the calories consumed during various eals throughout the week and presents some statistics and tables from this data. ou are to complete these three methods to get the program working: CalculateAverageByMeal() DisplayMealAverage() DisplayAverageCaloriesPerMeal() hen these three methods have been completed, your program should produce the following output Welcome to Calorie Counter Daily Averages Monday Tuesday Wednesday Thursday Friday Saturday Sunday 890 : 1.333 1.100 1.02? 967 : 1.208 1.107 Breakfast Lunch Dinne Average per Heal 554 960 1.757 Average calories 1,090 ss enterr to exit sure that you display the results in the same format as the above image so that 1000.809 displays as 1,000. This can be done using the formatting methods previously troduced with the N' format specifier (an example is provided in the sample code) hile the provided program does contain a Main() method, this is for your convenience in developing and testing your functions. The AMS will test your alculateAverageByMeal(), DisplayMealAverage() and DisplayAverageCaloriesPerMeal() methods directly, which means they must be public

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!