I Have been working on this for a few days now, and I seem to be missing something. What I have to do is:
Design a C# solution with a Main ( ) method that holds an integer variable named seconds to which you will assign a value. Create a method to which you pass this value. The method displays the seconds in minutes and seconds. As an example 66 seconds is 1 minute and 6 seconds.
Add a second method to the solution. This method displays a passed argument as hours, minutes and seconds. For example 3666 seconds is 1 hour, 1 minute and 6 seconds.
Add a statement to the Main ( ) method so that after it calls the methods to convert seconds to minutes and seconds, it passes the same value to the new method to convert it to hours, minutes and seconds.
Here is what I have so far:
static void Main()
{
int seconds=9691;
timeCal(ref seconds);
Console.WriteLine("{0) seconds equals {1} minute and {2} seconds",seconds,minutes);
}
static void timeCal(ref int Seconds)
{
hour = seconds /(60*60);
minutes = seconds / 60%60;
calSeconds = seconds % 60;
Console.WriteLine(" {0} seconds equal {1} hour, {2} minutes and {3} seconds.",seconds,minutes,hour,calSeconds);
}
I keep getting the errors:
the name 'calSeconds' does not exist in class or namespace
the name 'minutes' does not exist in class or namespace
the name 'hour' does not exist in class or namespace
I first figured that I didn't initilaize them, but when I did, I got the same errors. I'm completely stuck as to what I'm supposed to be adding so they will exist. Any clues will be well appriciated ;)
Thanks
Shanir