In: Computer Science
Create a C# console application (do not create a .NET CORE project) and name the project TimeToBurn. Running on a particular treadmill, you burn 3.9 calories per minute. Ask the user how many calories they wish to burn in this workout session (this is their goal). Once they tell you, output on the console after each minute, how many calories they have burned (e.g. After 1 minute, you have burned 3.9 calories). Keep outputting the total amount of calories they have burned until they have met their goal.
using System;
class TimeToBurn
{
static void Main(string[] args)
{
double calories_per_minute = 3.9;
// Take input for total calories to be burned
Console.Write("How many calories you want to burn? ");
double total_calories = Convert.ToDouble(Console.ReadLine());
int minute = 1;
double calories_burned = 0;
// Iterate loop till goal doesn't reached
// means calories_burned <= total_calories
while (calories_burned < total_calories)
{
// Calculate calories burned
// Print it
// Increment minute by 1
calories_burned = calories_per_minute * minute;
Console.WriteLine("After "+minute+" minute "+ calories_burned + "
calories burned.");
minute += 1;
}
}
}
OUTPUT