Advertisement
amigojapan

modem estimate

Sep 14th, 2015
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2.  
  3. namespace modem
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main (string[] args)
  8.         {
  9.             Console.WriteLine ("Welcome to the dowload time estimator");
  10.             Console.WriteLine ("This program with help you calculate how much time it will take you to download a file wiht a 56k modem");
  11.             Console.WriteLine ("Enter file size:");
  12.             string MBstr = Console.ReadLine();
  13.  
  14.             int MBint=(Int32.Parse(MBstr)*1024);
  15.             double secs = MBint / 5.2;
  16.             //TimeSpan t = TimeSpan.FromSeconds( secs );
  17.             //string timestring = string.Format("{0:D2}h:{1:D2}m:{2:D2}s:{3:D3}ms", t.Hours, t.Minutes, t.Seconds, t.Milliseconds);
  18.             int minutes=(int)secs/60;
  19.             int hours = minutes / 60;
  20.             minutes = minutes % 60;
  21.             int seconds = (int)secs % 60;
  22.  
  23.  
  24.             Console.WriteLine ("MB:"+MBint+": hours"+ hours+" minutes:" +minutes+" seconds:"+seconds);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement