saimun1

Programming basics Exam 18Dec 01. Distance

May 9th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Testing
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main (string[] args)
  8.  
  9.         {
  10.             float firstSpeed = int.Parse (Console.ReadLine ());
  11.             float firstTime = float.Parse (Console.ReadLine ());
  12.             float secondTime = float.Parse (Console.ReadLine ());
  13.             float thirdTime = float.Parse (Console.ReadLine ());
  14.  
  15.             //Formating to hours
  16.             firstTime /= 60;
  17.             secondTime /= 60;
  18.             thirdTime /= 60;
  19.  
  20.             float firstLine = firstSpeed * firstTime;
  21.             double secondLine = (firstSpeed*1.10) * secondTime;
  22.             double thirdLine = (firstSpeed * 1.10 ) * 0.95* thirdTime;
  23.             double overallKm = firstLine + secondLine + thirdLine;
  24.             Console.WriteLine("{0:f2}",overallKm);
  25.  
  26.  
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment