Esempio n. 1
0
 /// <summary>
 /// This method will ask the user to enter the number of feet
 /// and it will convert that value to miles and display the
 /// result to the user
 /// </summary>
 public static void TestFeetToMiles()
 {
     UserLib.WriteTitle("Task 4.1 Feet -> Miles");
     feet  = UserLib.GetDouble("Please enter the number of feet > ");
     miles = DistanceConverter.FeetToMiles(feet);
     Console.WriteLine("The number of miles = " + miles.ToString("#.##"));
 }
Esempio n. 2
0
        public static void Load()
        {
            double  weight      = 0;
            double  totalWeight = 0;
            int     count       = 0;
            decimal moneyTaken  = 0;
            bool    isFull      = false;

            UserLib.WriteTitle("Passenger Ferry");

            while (!isFull)
            {
                count++;

                weight = UserLib.GetDouble("Enter next passenger weight > ");

                if (totalWeight + weight > MAX_WEIGHT)
                {
                    Console.WriteLine("Max weight exceeded!");
                    Console.WriteLine("Passenger Rejected!");
                    isFull = true;
                    count--;
                }
                else
                {
                    Console.WriteLine("Passenger Accepted!");
                    moneyTaken  += 100;
                    totalWeight += weight;
                }
            }

            Console.WriteLine("Total Money = " + moneyTaken.ToString("c"));
            Console.WriteLine("Number of Passenger = " + count);
            Console.WriteLine("Total Weight = " + totalWeight.ToString("####"));
        }
Esempio n. 3
0
 /// <summary>
 /// This method will ask the user to enter the number of miles
 /// and it will convert that value to feet and display the
 /// result to the user
 /// </summary>
 public static void TestMilesToFeet()
 {
     UserLib.WriteTitle("Task 4.1 Miles -> Feet");
     miles = UserLib.GetDouble("Please enter the number of miles > ");
     feet  = DistanceConverter.MilesToFeet(miles);
     Console.WriteLine("The number of feet = " + feet.ToString("#.##"));
 }
Esempio n. 4
0
        /// <summary>
        /// This method will ask the user to enter the number of miles
        /// and it will convert that value to feet and display the
        /// result to the user
        /// </summary>
        public void TestMilesToFeet()
        {
            UserLib.WriteTitle("Task 4.1 Miles -> Feet");

            miles = UserLib.GetDouble("Please enter the number of miles > ");
            feet  = converter.MilesToFeet(miles);
            Console.WriteLine("The number of feet = " + feet);
        }