Ok I think im getting better at these but not quite still have these implicit convert from int to string problems and the usual "does not exist in the current context" dilemma.
/*
* */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Calories
{
class Calories
{
static void Main()
{
string hours,
minutes,
hoursSpent,
minutesSpent;
double caloriesBurned;
hoursSpent = GetHours();
minutesSpent = GetMinutes();
DisplayInstructions();
Console.WriteLine("\nData Entry");
hours = GetHours();
minutes = GetMinutes();
caloriesBurned = 3.9 * minutes;
Console.WriteLine("\nPress any key to continue");
Console.ReadKey();
DisplayResults(hours, minutes, caloriesBurned);
Console.ReadKey();
} // main ends
public static void DisplayInstructions()
{
Console.Clear();
Console.WriteLine("This program will calculate how many calories burned on a treadmill");
Console.WriteLine(" ");
Console.ReadKey();
} // end of DisplayInstructions Method
public static int GetHours()
{
string userHours;
string hours;
Console.WriteLine("Please enter in the number of hours spent on treadmill: ");
userHours = Console.ReadLine();
hoursSpent = int.Parse(userHours);
return hoursSpent;
} // end of GetHours method
public static string GetMinutes()
{
string userMinutes,
minutes;
Console.WriteLine("Please enter the number of minutes spent on treadmill: ");
userMinutes = Console.ReadLine();
minutesSpent = int.Parse(userMinutes);
return minutesSpent;
} //end of GetMinutes method
public static double caloriesBurned(int minutes)
{
return (3.9 * minutes);
} // end of caloriesBurned method
public static void DisplayResults(string GetMinutes, string GetHours, double caloriesBurned)
{
Console.Clear();
Console.WriteLine("Minutes:\t\t {0:N1}" +
"Hours: \t\t {1:N1}" +
"Calories Burned: \t\t {2:N1}", GetMinutes,
GetHours, caloriesBurned);
} //ends display results method
} // end class
} // end namespace
errors:
Error 4 The name 'hoursSpent' does not exist in the current context 54 14 Calories
Error 6 The name 'minutesSpent' does not exist in the current context 65 14 Calories
Error 5 The name 'hoursSpent' does not exist in the current context 55 20 Calories
Error 7 The name 'minutesSpent' does not exist in the current context 66 20 Calories
Error 2 Cannot implicitly convert type 'int' to 'string' 28 21 Calories
Error 1 Cannot implicitly convert type 'int' to 'string' 19 27 Calories
Error 3 Operator '*' cannot be applied to operands of type 'double' and 'string' 30 30 Calories
Thanks again for the help
Also it would be awesome if you can tell me how to avoid "does not exist in current context errrors" and " cannot implicitly convert type int to string" errors as well.