Not sure what I am doing wrong. My homework says Design 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.
Add a second method top the solution. This method displays a passed argument as hours, minutes and 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.
This is what my code looks like

public class Lab4
{
public static void Main()
{
MinutesSeconds()
HoursMinutesSeconds()
Console.WriteLine("Seconds==98");
}
public static void MinutesSeconds()
{
Console.WriteLine("98 Seconds==1 Minute 38 Seconds");
}
publice static void HoursMinutesSeconds()
{
Console.WriteLine("1 Minute 38 Seconds==0 Hours 1 Minute 38 Seconds");
}
}

What am I doing wrong?

When i try and run i get this
The name 'Console' does not exist in the current context (CS0103) - C:\Documents and Settings\Owner\My Documents\SharpDevelop Projects\Lab4\Program.cs:8,9

Charlie81, try and search the completed C# threads. I know I have seen this exact example more than once. With just the minutes and seconds different than yours.

On the right side of the screen there is a "Related Features" box, under that is "solved C# threads."

Give that a try. I sure you will find a few people have had that same question, and it's already solved.

Good luck.

Ok i have pretty much got it but I still have 2 errors.
This is what I have now.

using System;
public class Lab4_
{
public static void Main()
{
string inputSeconds;
int seconds;
int minutes = 60;
console.readline("inputseconds=90031")
seconds = Convert.ToInt32(inputSeconds);
ComputeMinutesFromSeconds(seconds,minutes);
}
public static void ComputeMinutesFromSeconds(int seconds, int minutes);
{
int totalMinutes;
int remainingSeconds;
minutes == seconds/60%60;
ComputeHoursFromMinutes(totalMinutes,int minutes, int seconds,int remainingSeconds);
}
public static void ComputeHoursFromMinutes(int totalMinutes, int minutes, int seconds, int remainingSeconds)
{
int totalHours;
int remainingMinutes;
hour=minute*60;
Console.WriteLine("{0) seconds equals {1} minute and {2} seconds",seconds,minutes);
Console.WriteLine(" {0} seconds equal {1} hour, {2} minutes and {3} seconds.",seconds,minutes,hour,calSeconds);
}
}

Any ideas what I am doing wrong?

Can anyone tell me what I am doing wrong?

this should work... was made in hurry and im at the beginning... and thats not a good for cycle, but it works... when i'll have more time im going to improve it :)

your code's really strange guy :S

using System;
public class Lab4_
{
    public static void Main()
        {
        int seconds;
        Console.WriteLine("\nSeconds: ");
        seconds = int.Parse(Console.ReadLine());
        ComputeMinutesFromSeconds(seconds);
    }
    public static void ComputeMinutesFromSeconds(int Seconds)
    { 
      int seconds=Seconds;
      int initialseconds=seconds;
      int minutes=0;
      for (; seconds >= 0; seconds = seconds - 60, minutes++) ;
      seconds = seconds + 60;
      minutes--;
        ComputeHoursFromMinutes(minutes, seconds ,initialseconds);
      }
      public static void ComputeHoursFromMinutes(int Minutes, int Seconds, int Initialseconds)
          {
          int minutes = Minutes; 
          int seconds = Seconds;
          int initialseconds = Initialseconds;
          int hours=0;
          for (; minutes >= 0; minutes = minutes - 60, hours++) ;
          minutes = minutes + 60;
          hours--;
          Console.WriteLine(" {0} seconds equal to {1} hour, {2} minutes and {3} seconds.",initialseconds,hours,minutes,seconds);
      }
}

Thank you for the help I was so lost on how to do this stuff now that i see how it is done I should be ok.

:) it's been a pleasure...


For me is the same:when I try hard on finding a solution, it never comes :'(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.