Esempio n. 1
0
 void Calculate(object sender, EventArgs e)
 {
     try
     {
         if (calculateTo.SelectedIndex == -1)
         {
             Alerts.InvalidInput(messageToUser: AppResources.emtpyEquationPickerCalculate);
         }
         else
         {
             if (calculateTo.SelectedIndex == 0)
             {
                 Result.Text = Velocity_VUAT.getFinalVelocity(initialVelocityEntry.Text, accelerationEntry.Text, timeEntry.Text).ToString();
                 //showHow.Text = $"The distance travelled of and object is equal to the velocity of the object times the time it takes. \r\n {Result.Text} = {velocityEntry.Text} * {timeEntry.Text}";
             }
             else if (calculateTo.SelectedIndex == 1)
             {
                 Result.Text = Velocity_VUAT.getInitialVelocity(finalVelocityEntry.Text, accelerationEntry.Text, timeEntry.Text).ToString();
                 //showHow.Text = $"The distance travelled of and object is equal to the velocity of the object times the time it takes. \r\n {Result.Text} = {velocityEntry.Text} * {timeEntry.Text}";      }
             }
             else if (calculateTo.SelectedIndex == 2)
             {
                 Result.Text = Velocity_VUAT.getAcceleration(finalVelocityEntry.Text, initialVelocityEntry.Text, timeEntry.Text).ToString();
                 //showHow.Text = $"The distance travelled of and object is equal to the velocity of the object times the time it takes. \r\n {Result.Text} = {velocityEntry.Text} * {timeEntry.Text}";  }
             }
             else
             {
                 Result.Text = Velocity_VUAT.getTime(finalVelocityEntry.Text, initialVelocityEntry.Text, accelerationEntry.Text).ToString();
             }
         }
     }
     catch (FormatException j)
     {
         Alerts.InvalidInput(messageToUser: AppResources.errorFormatMessage);
     }
     catch (DivideByZeroException j)
     {
         Alerts.InvalidInput(messageToUser: AppResources.errorDivideByZeroMessage);
     }
     catch (Exception j)
     {
         Alerts.InvalidInput(messageToUser: j.Message);
     }
 }
Esempio n. 2
0
        public void VUAT_Can_Calculate_Time()
        {
            var time = Velocity_VUAT.getTime("200", "100", "50");

            Assert.IsTrue(time == (decimal)2);
        }
Esempio n. 3
0
        public void VUAT_Can_Calculate_InitialVelocity()
        {
            var initialVelocity = Velocity_VUAT.getInitialVelocity("1000", "1", "50");

            Assert.IsTrue(initialVelocity == (decimal)950);
        }
Esempio n. 4
0
        public void VUAT_Can_Calculate_Acceleration()
        {
            var acceleration = Velocity_VUAT.getAcceleration("100", "1", "5");

            Assert.IsTrue(acceleration == (decimal)19.8);
        }
Esempio n. 5
0
        public void VUAT_Can_Calculate_FinalVelocity()
        {
            var finalVelocity = Velocity_VUAT.getFinalVelocity("100", "10", "10");

            Assert.IsTrue(finalVelocity == (decimal)200);
        }