static void Main(string[] args) { // Demonstrates using the Factory Pattern, Strategy Pattern, and the Singleton Pattern. DumbbellFactory dumbbellFactory = new DumbbellFactory(); Dumbbell dumbbellOne = dumbbellFactory.createDumbbell(100); Dumbbell dumbbellTwo = dumbbellFactory.createDumbbell(25); CompoundLiftWeightBehavior compoundLiftWeight = new CompoundLiftWeightBehavior(); AccessoryLiftWeightBehavior accessoryLiftWeight = new AccessoryLiftWeightBehavior(); Max max = Max.Instance; max.Description(); Workout workout = new Workout(compoundLiftWeight); max.LiftWeights(workout, dumbbellOne); max.LiftWeights(workout, dumbbellTwo); workout = new Workout(accessoryLiftWeight); max.LiftWeights(workout, dumbbellTwo); Console.WriteLine("Please enter the heaviest weight you can lift 3-5 times."); double userInput = Convert.ToDouble(Console.ReadLine()); WorkoutWeightCalculator test = new StrengthTraining(userInput); double answer = test.CalculateFormula(); Console.WriteLine(Math.Round(answer, 0) + "lbs is the weight you should be training at for strength."); }
private void Window_MouseDown(object sender, MouseButtonEventArgs e) { var d = new Dumbbell(e.GetPosition(this)); DrawCanvas.Children.Add(d.FirstDot); DrawCanvas.Children.Add(d.SecondDot); DrawCanvas.Children.Add(d.Link); }
/// <summary> /// Lifts the weights in a compound manner. /// </summary> /// <param name="dumbell">The dumbbell being lifted.</param> public string LiftWeights(Dumbbell dumbell) { string phrase = "doing compound movements with dumbbells that weigh " + dumbell.Weight; return(phrase); }
/// <summary> /// The method used so Max can lift some weights. /// </summary> public void LiftWeights(Workout workout, Dumbbell dumbbell) { this.workout = workout; this.workout.GoLift(dumbbell); }
/// <summary> /// The method used to lift dumbbells in a certain way. /// </summary> /// <param name="dumbbell">The dumbbells being used to workout with.</param> public void GoLift(Dumbbell dumbbell) { string phrase = this.liftWeightBehavior.LiftWeights(dumbbell); Console.WriteLine("Working out by " + phrase); }